I tried the sample codes for imagemagick and it was able to save out document开发者_StackOverflow中文版 previews to the folder on the server.
I tried sample code for fpdf and it was able to render the PDF file fine when it is sent but fails when I ask it to save for directory.
Researching online it says the resolution to the fpdf issue is to set file permission to 777 (any source access permitted, as I understand). My default folder permission is 755.
I want to ask if anyone knows why I can save with imagemagick but not with fpdf.
The reason, I suspect, is because imagemagick calls requires exec() which is effectively command line access. As I understand it however, fpdf is just a PHP wrapper for PDF libraries already present on the server so should have the same availability to exec().
Haven't had a chance to go through the code of fpdf yet but as I am a noob to PHP I don't think that is going to be particularly enlightening.
Please help!
EDIT: As requested
FPDF
$pdf->Output('testdocument.pdf', 'F');
http://www.fpdf.org/en/doc/output.htm
Imagmagick
exec('convert "docprev.pdf[0]" -colorspace RGB -geometry 200 "document2.png"');
So those are the output commands of FPDF and Imagemagick respectively.
精彩评论