本文介绍了Bash脚本在Linux中将pdf打印为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题听起来有点奇怪,但是我发誓实际的任务相对简单!

The question probably sounds a little odd, but the actual task is relatively simple, I swear!

我正在使用PDFCreator将生成的FDF合并到预先存在的PDF中,从Web表单自动生成一些PDF.我在NitroPDF中创建了预先存在的PDF.此设置适用于 great -差不多.问题在于,当您在Adobe Reader 9(最常见的阅读器)中查看生成的PDF时,这些字段的一部分只是空白.信息仍然存在;使用Adobe Reader的早期版本或Foxit Reader等其他阅读器将显示整个PDF.不知道发生了什么,由于我没有使用Adobe软件创建PDF,因此Adobe技术支持毫无用处. (如果您想帮助解决此问题,而不是以下问题,请随时给我发送电子邮件.)

I'm automatically generating some PDFs from a webform, using PDFCreator to merge a generated FDF into a preexisting PDF. I created the preexisting PDF in NitroPDF. This setup works great - almost. The problem is that when you view the generated PDFs in Adobe Reader 9 (the most common reader) a subset of the fields are just blank. The information is still there; using previous versions of Adobe Reader or a different reader like Foxit Reader shows the entire PDF. No clue what's going on, and Adobe tech support was useless since I didn't create the PDF with Adobe software. (If you'd like to help fix this problem instead of the following, feel free to email me.)

但是,如果我将生成的PDF并使用PDF打印机驱动程序将其打印为新的PDF,那么它在任何地方都可以正常工作.这对于我们的销售部门来说很费时,而且很烦人,所以我想在创建第一个PDF时自动执行此步骤.

However, if I take the resultant PDF and print it to a fresh PDF using a PDF printer driver, it works great everywhere. This is time-consuming and annoying for our sales department to do themselves, so I want to perform this step automagically upon creating the first PDF.

我在ubuntu中,并且可以通过命令行对服务器进行root访问.该程序是用PHP编写的,可以轻松地进行系统调用.我只是想弄清楚如何正确地将东西绑在一起,以便可以使用特定的打印机驱动程序将已知文件自动打印到另一个已知文件.

I'm in ubuntu, and have command-line root access to the server. The program is written in PHP, and can easily make system calls. I'm just having trouble figuring out how to tie things together properly so that I can automatically print a known file using a specific printer driver to another known file.

推荐答案

您可以尝试通过Ghostscript放置PDF文件.我发现这足以修复许多有问题的PDF.

You could try putting your PDF files through Ghostscript. I have found that this is enough to fix many problematic PDFs.

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf

(同一命令还可用于将多个PDF文件合并为一个,只需指定多个输入文件即可.)

(The same command can also be used to merge several PDF files into one, just specify multiple input files.)

这篇关于Bash脚本在Linux中将pdf打印为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 21:09