Our server does the heavy lifting and generates the PDFs for you. The generated PDF files will be returned and stored on your server in the specified directory with your specified file name, or you can set them to be created and displayed or downloaded by a user on the fly.
You do not need any special packages or permissions. It works on any server running PHP!
We have simplified our API so that you just need to download the phpToPDF.php file from your account and include it in your code. It's that simple.
Get started :: PHP to PDF generation steps
1 Sign up to access our API
2 FREE!
3 Download and include phpToPDF.php
Sample Code
Use the phptopdf() function for creating a PDF using a URL
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.com/ */ require('phpToPDF.php'); //Set Your Options -- see documentation for all options $pdf_options = array( "source_type" => 'url', "source" => 'http://google.com', "action" => 'save'); //Code to generate PDF file from options above phptopdf($pdf_options); ?>
Alternatively, you can use the phptopdf() function to pass a varible that holds html code for your PDF.
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.com/ */ require('phpToPDF.php'); //Your HTML in a variable $my_html="PDF from HTML using phpToPDF
"; //Set Your Options -- we are saving the PDF as 'my_filename.pdf' to a 'my_pdfs' folder $pdf_options = array( "source_type" => 'html', "source" => $my_html, "action" => 'save', "save_directory" => 'my_pdfs', "file_name" => 'my_filename.pdf'); //Code to generate PDF file from options above phptopdf($pdf_options); ?>
[ More Examples ]
0 comments:
Post a Comment