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

How to Set the PDF Name

ckeilson wrote on 2013-09-27:
I do not know how to incorporate the code to set the PDF name. Below is my code. If you can tell me where to set the PDF name that would be great. It is not working when I put it under the "header section. The PDF still says it is an untitled document.

	$product_ID = $_GET['product_ID'];


require 'pdfcrowd.php';


$url = "" . $product_ID;

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

    // convert a web page and store the generated PDF into a $pdf variable
    $pdf = $client->convertURI($url);

    // set HTTP response headers
    header("Content-Type: application/pdf");
    header("Cache-Control: no-cache");
    header("Accept-Ranges: none");
    header("Content-Disposition: attachment; filename=\"Spec Sheet from EJB Plastics.pdf\"");
    // send the generated PDF 
    echo $pdf;

catch(PdfcrowdException $why)
    echo "Pdfcrowd Error: " . $why;
support wrote on 2013-09-30:

The PDF title is taken from the <title> tag. Example:
    <title>Document Title</title>