PDF creation

Hey mates,
i encountered a problem which i can’t solve.

Right now i reworked the invoice-PDF module, so it can send e-mails.
For that case, i need to create a PDF on the fly and either store in in the filesystem, or create it from the binary string.

I found the snippet which creates the PDF and everything works fine when i output it with the paramter “I” (default).

As soon as I change the parameter to “F” or “S” (file or string), my PDF file is empty. I can open it (so the structure of the binary code seems to be correct, since it doesn’t throw any errors) - but for some reason, my whole content is gone.

Any ideas?

For example, i’m trying this:

$output = $oPdf->output(OX_BASE_PATH."/tmp/".$sFilename, 'S');    

This returns the binary-code of the PDF

Right now, when i try to create it with:

file_put_contents($filename, $output);

its just empty. Any ideas?

sigh …

if you dump $output before file_put_contents, is it also empty?

i guess there is some php oder webserver misconfiguration, since either tcpdf itself or you custom scripts can save pdf to disk. Did you check the log files?

Well, i somehow managed it solve the problem. Even though it is strange.
If i story my file in a folder (/tmp/myFile.pdf) and open it … no content.

BUT: if i send the pdf via e-mail, it works. I guess i just forgot to add “file_get_contents” or something like that. Silly me.

// btw. neat avatar, vanilla

One time you use: $sFilename
One time you use: $filename

[QUOTE=foxido.de;148094]One time you use: $sFilename
One time you use: $filename[/QUOTE]

havn’t noticed that, you are right. That might have been the error.
Thanks for figuring that out :slight_smile: