Convert PHP Web Page to generated PDF as HTTP Response

by Dinesh 2013-11-04 15:38:59

The following code converts a web page and sends the generated PDF as HTTP response


// create an API client instance
$client = new Pdfcrowd("username", "apikey");

// convert a web page and store the generated PDF into a variable
$pdf = $client->convertURI('http://hioxindia.com');

// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename="google_com.pdf"");

// send the generated PDF
echo $pdf;

Tagged in:

845
like
0
dislike
0
mail
flag

You must LOGIN to add comments