How convert an URL to PDF and let the user download the result?

Question:I have a lot of different sites written in PHP and more and more often clients ask me to create PDF of various lists, product descriptions and so on. I've been using some application and other PDF libraries but they are a pain to use and have a very limited functionality. Are there any services out there that'll let me generate a PDF file from a URL and let the user download the result? That would definitely save my day 🙂 Is there any solution on VeryPDF?

Answer: According to your needs, maybe you can have a free trial of this application: VeryPDF Office Document to PDF Converter Cloud API, by which you can convert various formats files through URL to PDF. And this free online application is cloud based, so you can call it from PHP code at any computer system without any limitation. When conversion finishes, there will be an URL of output PDF produced, by which the users can download the result easily. Please check more information of this software on homepage, in the following part, I will show you how to use this software.

Convert URL to PDF from various input files

  • This software is cloud based application, so when run the conversion, you do not need to download any application. Simply open any browser at any computer system to run the conversion following the example of this URL:
    When converting Doc of URL to PDF, please refer to the following URL:
    http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=doc2any&infile=http://online.verypdf.com/examples/cloud-api/verypdf.doc&outfile=verypdf.pdf
    The structure of the URL: the main website URL of website http://online.verypdf.com/api/: if you have API code, please input next to it or else there will be watermark on output; then please input the full URL of input doc file; at the end, please specify the output PDF name. By this method, you can convert doc of URL to PDF.
  • Another example of converting Excel of URL to PDF:
    http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=doc2any&infile=http://online.verypdf.com/examples/cloud-api/verypdf.xls&in_ext=.xls&outfile=verypdf.pdf

This free online application can help you convert files of Word (DOC, DOCX), Excel (XLS, XLSX), PowerPoint (PPT, PPTX), RTF formats to PDF format. When you run the conversion, simply change the file format of input, then you can make it.

Run conversion of URL to PDF from PHP

  • When you run the conversion from PHP code, please refer to the following code template:
  • ?php
    //The Code
    /* gets the data from a URL */
    function get_data($url)
    {
        $ch = curl_init();
        $timeout = 5;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
    }

    //The Usage
    $returned_content = get_data('http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=doc2any&infile=http://online.verypdf.com/examples/cloud-api/verypdf.pptx&outfile=out.pdf');
    echo $returned_content;
    ?>

If you need to check more examples, please go to website and homepage. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!