I am using PHP4.4. And want to convert some other webpage to PDF and save it in server on button click from my current PHP page.
There are many options available but all supports PHP > 5 version.
I want some API where if I will pass webpage URL and click on a button from my current webpage, then it should convert that webpage to PDF and save in server.
Please suggest some free version API. Already tried many options like wkhtmltopdf, FPDF, PDFJs etc.but nothing works as I am using PHP 4.4.
Mybe you help using Pdfcrowd
. Simple example :
require 'pdfcrowd.php';
try
{
// create an API client instance
$client = new Pdfcrowd("username", "apikey");
// convert a web page and store the generated PDF into a $pdf variable
$pdf = $client->convertURI('http://example.com/');
// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"created.pdf\"");
// send the generated PDF
echo $pdf;
}
catch(PdfcrowdException $e)
{
echo "Pdfcrowd Error: " . $e->getMessage();
}
Pdfcrowd
is simple library end if you catch an exception you will change the library. Mybe it's help you.