Open pdf File in fpdf and return ist content

廉价感情. 提交于 2019-12-08 12:32:56

问题


is there any way, to ope a pdf file in fpdf and return its content? This is my current code:

$pdf=new FPDF();
$pdf->Open();
var_dump($pdf); 

The var_dump() currently returns only document properties.


回答1:


In case you want to create a preview image of your PDF file, download Ghostscript and ImageMagick. Install them as they are needed to create images. By the way, these applications may already be installed on your system (so check first).

Use the following PHP code to create preview images (200px wide) for all pages of your PDF file.

exec('convert "document.pdf" -colorspace RGB -geometry 200 "document.png"');

If you only want to create one preview image, use the following code. You may replace the number inside the square brackets by the desired page number starting at 0.

exec('convert "document.pdf[0]" -colorspace RGB -geometry 200 "document.png"');


来源:https://stackoverflow.com/questions/5824010/open-pdf-file-in-fpdf-and-return-ist-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!