How do I extract image from a pdf file using php [closed]

怎甘沉沦 提交于 2019-11-28 12:22:32

问题


Please, any ideas on how to extract image from pdf in php?


回答1:


Take a look at pdfimages. Here is the description from the page:

Pdfimages saves images from a Portable Document Format (PDF) file as Portable Pixmap (PPM), Portable Bitmap (PBM), or JPEG files.

Pdfimages reads the PDF file, scans one or more pages, PDF-file, and writes one PPM, PBM, or JPEG file for each image, image-root-nnn.xxx, where nnn is the image number and xxx is the image type (.ppm, .pbm, .jpg).

NB: pdfimages extracts the raw image data from the PDF file, without performing any additional transforms. Any rotation, clipping, color inversion, etc. done by the PDF content stream is ignored.




回答2:


I believe you can use imagemagic as well. You can send it command line arguments and snap a picture given the coordinates you can provide. You will need to install some rpms etc.




回答3:


Check out PDFLib. Their TET product does just that. You can get the images and text out... Only thing it doesn't cover is vector images.




回答4:


If you have an existing PDF File I guess it's pretty impossible to extract an image from there using PHP, maybe you'll have better luck with C: you need to disassemble the binary file, decode/decompress/decompile it and find where the image is stored, then copy it.

It's easier if you just copy'n'paste it.



来源:https://stackoverflow.com/questions/1606175/how-do-i-extract-image-from-a-pdf-file-using-php

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