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

php tp pdf

xanu wrote on 2012-11-15:
I am searching for a php to pdf convert library that i can use in my projects. Then i found pdfcrowd. I am planning to buy a monthly plan if everything works fine. I want to use this library to convert my dynamic php file to pdf. I already downloaded it and runs sone test. But i seems that i cannot make it running and it gives me an error message. I use the location of my local php file and pass some values in its url.
the code looks like this:

$pdf = $client->convertFile('http://localhost/myfolder/report.php?begin=1/1/12&end=1/31/12');

It gives me an error message that pdf crown cannot find the file specified. I am thinking of that this happens because i added some values in the URL. Please give me a solution to this. Thank you so much.
support wrote on 2012-11-15:
PDFs are created on our servers, the client library on your machine just calls our online API and passes it an URL to create PDF. The URL must be publicly accessible so that our service can load it. Since your web page is served by "localhost", which is not accessible outside of your machine, the service returns an error.

Another thing is that you should use the convertURI() method:
$pdf = $client->convertURI('http://app.domain.com/myfolder/report.php?begin=1/1/12&end=1/31/12');

convertFile() converts a local file on your machine, not an URL.