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

Convert html file from server to pdf and put the pdf in server

nimrod_s wrote on 2016-04-12:
Hi,
what is the code to convert html file from server to pdf and then to store the pdf in the server ?
support wrote on 2016-04-13:
Hello,

If you want to save the file locally on the server where it is created, you can use this (PHP) code:
$out_file = fopen($outfilepath.$filename, "wb");
$client->convertURI("http://example.com", out_file);
fclose($out_file);
nimrod_s wrote on 2016-04-13:
Do i need to use anything else ?
can u give me the full code ?
support wrote on 2016-04-13:
The minimal PHP code:
require 'pdfcrowd.php';
$client = new Pdfcrowd("***", "***");
$out_file = fopen($outfilepath.$filename, "wb");
$client->convertURI("http://example.com", out_file);
fclose($out_file);

You can find details and examples here: https://pdfcrowd.com/api/html-to-pdf-php/
nimrod_s wrote on 2016-04-14:
i found a solution,
thanks