如何使用 php 从 pdf 文件中提取图像

发布于 2024-08-08 08:46:06 字数 1436 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

老娘不死你永远是小三 2024-08-15 08:46:06

看一下 pdfimages。以下是该页面的描述:

Pdfimages 从便携式设备中保存图像
文档格式 (PDF) 文件为
便携式像素图 (PPM)、便携式位图
(PBM) 或 JPEG 文件。

Pdfimages读取PDF文件,扫描
一页或多页、PDF 文件,以及
写入一个 PPM、PBM 或 JPEG 文件
每个图像,image-root-nnn.xxx,
其中 nnn 是图像编号,
xxx 是图像类型(.ppm、.pbm、
.jpg)。

注意: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.

怪我入戏太深 2024-08-15 08:46:06

我相信你也可以使用 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.

葬シ愛 2024-08-15 08:46:06

查看 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.

蘸点软妹酱 2024-08-15 08:46:06

如果你有一个现有的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文