使用ghostscript将图像转换为较低版本(1.4)时,图像将替换为空白空格

时间:2021-12-03 21:18:28

Images are replaced with blank white space while converting pdf to lower version (1.4 ) using ghostscript. Everything seems fine but some content such as images of pdf was replaced. How to keep all content safe on converted pdf file? Script i used:

使用ghostscript将图像转换为较低版本(1.4)时,图像将替换为空白空格。一切似乎都很好但是一些内容如pdf的图像被替换了。如何在转换的pdf文件中保持所有内容的安全?我使用的脚本:

shell_exec( "gs -sDEVICE=pdfwrite  -dSAFER  -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH   -sOutputFile=$output $source");

1 个解决方案

#1


OK, first caveat, you aren't 'converting' your PDF file, you are making a new one. The new one has limitations not present in the original.

好的,首先请注意,你没有“转换”你的PDF文件,你正在制作一个新文件。新的限制在原始版本中没有。

What version of Ghostscript are you using, on what platform, and where did you get it from ?

您使用的是什么版本的Ghostscript,在什么平台上,以及从哪里获得它?

You are running with -dQUIET which limits the output you get, I would suggest that you don't do that, then you paste the backchannel from the application here which just might tell you something meaningful. You will, obviously, want to run that from the command line, not PHP.

你正在运行-dQUIET来限制你得到的输出,我建议你不要这样做,然后你粘贴来自应用程序的反向通道,这可能会告诉你一些有意义的东西。显然,您希望从命令行运行它,而不是PHP。

However, its likely that nobody is going to be able to help you at all without seeing your original PDF file. If you think you have found a bug then your best bet is to open a bug report at bugs.ghostscript.com, where you can attach a specimen file that exhibits the problem. Alternatively post the PDF file somewhere public and put a link here.

但是,如果没有看到您的原始PDF文件,很可能没有人能够帮助您。如果您认为自己发现了错误,那么最好的办法是在bugs.ghostscript.com上打开错误报告,在那里您可以附上展示问题的样本文件。或者将PDF文件发布到公共场所,并在此处添加链接。

#1


OK, first caveat, you aren't 'converting' your PDF file, you are making a new one. The new one has limitations not present in the original.

好的,首先请注意,你没有“转换”你的PDF文件,你正在制作一个新文件。新的限制在原始版本中没有。

What version of Ghostscript are you using, on what platform, and where did you get it from ?

您使用的是什么版本的Ghostscript,在什么平台上,以及从哪里获得它?

You are running with -dQUIET which limits the output you get, I would suggest that you don't do that, then you paste the backchannel from the application here which just might tell you something meaningful. You will, obviously, want to run that from the command line, not PHP.

你正在运行-dQUIET来限制你得到的输出,我建议你不要这样做,然后你粘贴来自应用程序的反向通道,这可能会告诉你一些有意义的东西。显然,您希望从命令行运行它,而不是PHP。

However, its likely that nobody is going to be able to help you at all without seeing your original PDF file. If you think you have found a bug then your best bet is to open a bug report at bugs.ghostscript.com, where you can attach a specimen file that exhibits the problem. Alternatively post the PDF file somewhere public and put a link here.

但是,如果没有看到您的原始PDF文件,很可能没有人能够帮助您。如果您认为自己发现了错误,那么最好的办法是在bugs.ghostscript.com上打开错误报告,在那里您可以附上展示问题的样本文件。或者将PDF文件发布到公共场所,并在此处添加链接。