注意:pdfimages 提取原始图像 PDF 文件中的数据,无 执行任何额外的 转变。任何旋转、剪裁、 由PDF完成的颜色反转等 内容流被忽略。
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.
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.
如果你有一个现有的 PDF 文件,我想使用 PHP 从那里提取图像几乎是不可能的,也许你使用 C 会更好:你需要反汇编二进制文件,解码/解压缩/反编译它并找到图像的位置已保存,然后复制。
如果您只是复制并粘贴它,那就更容易了。
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.
发布评论
评论(4)
看一下 pdfimages。以下是该页面的描述:
Take a look at pdfimages. Here is the description from the page:
我相信你也可以使用 imagemagic。您可以向其发送命令行参数,并根据您可以提供的坐标拍摄一张图片。您将需要安装一些 rpm 等。
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.
查看 PDFLib。他们的 TET 产品就是这样做的。您可以获取图像和文本...它唯一没有涵盖的是矢量图像。
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.
如果你有一个现有的 PDF 文件,我想使用 PHP 从那里提取图像几乎是不可能的,也许你使用 C 会更好:你需要反汇编二进制文件,解码/解压缩/反编译它并找到图像的位置已保存,然后复制。
如果您只是复制并粘贴它,那就更容易了。
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.