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

Write pdf directly to the server

RecomTech wrote on 2012-11-29:
I'm trying to write the pdf file directly to a directory on the server, without creating the pdf file to be downloaded to my local machine. The file name as a link so that it can be viewed immediately or have the link emailed.

Is it some version of this:

$out_file = fopen("document.pdf", "wb");
$client->convertURI('$url, $out_file);

I'm not familiar enough with PHP to completely understand "fopen" and "fwrite" commands.

Thank you.
support wrote on 2012-11-29:
You code looks correct to me. I would only suggest to use a full path to the destination directory on your server, eg
$out_file = fopen("/full/path/to/document.pdf", "wb"); 

fopen() creates a new file on your server, convertURI() writes PDF to that file, and fclose() closes the file.