This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Resize page

coniston wrote on 2017-03-01:
I am a new user. I have checked the different parameters to set the format of the page. Here they are:


But how do I integrate them in the basic example code to do their job. Where and how should they be put in the code hereafter to do the job? Can you please help me out?


require 'pdfcrowd.php';

function generatePDF()
if (!$_GET["pdf"])
return False;

try {
// build the url and remove the pdf field from the query string
$url = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"];
if (count($_GET) > 1) {
$url = $url . "?" . http_build_query($_GET, '', '&');

// call the API
$client = new Pdfcrowd("username", "apikey");
$pdf = $client->convertURI($url);

// send the generated pdf to the browser
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"created.pdf\"");

echo $pdf;
catch(PdfcrowdException $why) {
echo "PDF creation failed: ".$why."\n";

return True;

support wrote on 2017-03-01:

Any PDF customization API methods must be called right before $client->convertURI().