将数千个 Word 文档转换为单个 PCL 文件

发布于 2024-09-06 15:59:37 字数 348 浏览 8 评论 0原文

我们的客户有数万封 Word 2007 格式的信件。他们需要将所有字母组合成一个单个大型 PCL 文件,然后将其发送给打印供应商进行批量打印。

据我了解,PCL 内容是由特定的打印机驱动程序生成的。因此,无论是通过 Document.PrintOut() 函数以交互方式还是以编程方式使用 VBA,当调用打印到文件时,它都会将内容传递到所选/默认打印机驱动程序以输出 PCL 格式。

现在,他们有一个现有的 .NET 1.1 批处理作业,可以从这些 Word 文档生成 PDF。他们希望使用相同的批处理作业将它们合并到那个大的 PCL 文件中。如果该过程涉及打印机驱动程序,如何以编程方式将多个 Word 文档“打印”到同一个文件?

Our customer has tens of thousands of correspondence letters in Word 2007 format. They need to combine all the letters into a single large PCL file, which is then sent to the print vendor for bulk printing.

From what i understand PCL content is generated by a specific printer driver. So whether interactively or programmatically with VBA from the Document.PrintOut() function, when called to print to file, it passes content to the selected/default printer driver to output the PCL format.

Now, they have an existing .NET 1.1 batch job that generates PDF out from those Word documents. They wish to use the same batch job to combine them into that large PCL file. If a printer driver is involved in the process, how can multiple Word docs be programmatically "printed" to the same file?

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

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

发布评论

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

评论(3

泪冰清 2024-09-13 15:59:37

是否可以选择根据生成 PDF 的现有(工作!)批处理作业保留 PDF 输出?

您可以使用这些 PDF,将它们提供给 Ghostscript 命令并让 Ghostscript 输出 PCL。

您的 PDF 是否为单个文件,每个 Word 2007 文档对应一个文件?在这种情况下,您可以像这样运行 Ghostscript 来输出(例如)彩色 PCLXL:

gswin32c.exe ^
   -dBATCH ^
   -dNOPAUSE ^
   -dSAFER ^
   -sDEVICE=pxlcolor^
   -sOutputFile=c:/path/to/big.pcl ^
   1st.pdf ^
   second.pdf ^
   no3.pdf ^
   fourth.pdf ^
   [....]

如果黑白 PCL 足够好,则使用 "-sDEVICE=pxlmano"

注意事项:我不确定在一个命令行中可以排列的 PDF 数量的最大值是多少。如果这成为一个问题,我建议使用 pdftk.exe 将所有 PDF first 连接成一个 big.pdf ( http://www.accesspdf.com/pdftk/):

pdftk.exe ^
   1st.pdf ^
   second.pdf ^
   no3.pdf ^
   fourth.pdf ^
   [....] ^
   cat output ^
   big.pdf         # Here: direct control over order of the files in the result

或者,简单地使用通配符

pdftk.exe ^
   *.pdf ^
   cat output ^
   big.pdf         # Here: order of files is alphabetically

:当然,这里也可能会出现一个问题,即一个命令处理的文件数量受到限制。然而,使用第二种方法,首先通过几轮连接来构建更大的 PDF 会更容易。无论如何,最后:只需将您的 big.pdf 定向到 Ghostscript 以转换为 PCL/XL。

Is it an option to keep the PDF output based on the existing (working!) batch job that generates PDF?

The you could use these PDFs, feed them to a Ghostscript command and let Ghostscript output the PCL.

Are your PDFs single files, one for for each Word 2007 document? In this case, you can run Ghostscript like this to output (for example) color PCLXL:

gswin32c.exe ^
   -dBATCH ^
   -dNOPAUSE ^
   -dSAFER ^
   -sDEVICE=pxlcolor^
   -sOutputFile=c:/path/to/big.pcl ^
   1st.pdf ^
   second.pdf ^
   no3.pdf ^
   fourth.pdf ^
   [....]

If b/w PCL is good enough, then use "-sDEVICE=pxlmono".

Caveats: I'm not sure what the maximum is for the number of PDFs you can line up in one commandline. If it should become an issue, I'd recommend to concatenate all the PDFs first into one single big.pdf, using pdftk.exe (http://www.accesspdf.com/pdftk/):

pdftk.exe ^
   1st.pdf ^
   second.pdf ^
   no3.pdf ^
   fourth.pdf ^
   [....] ^
   cat output ^
   big.pdf         # Here: direct control over order of the files in the result

or, simply using wildcards:

pdftk.exe ^
   *.pdf ^
   cat output ^
   big.pdf         # Here: order of files is alphabetically

Of course, here also could come up an issue with a limitation regarding the number of files processed by one command. However, with the second method it is easier to build bigger PDFs first through several rounds of concatenating. In any case, at the end: just direct your big.pdf to Ghostscript to convert to PCL/XL.

您的好友蓝忘机已上羡 2024-09-13 15:59:37

我同意 Pipitas 的观点,现有流程的可行解决方案可以很好地发挥作用。根据保存为 Word 格式的方式,您可以通过使用“另存为”功能可编程性来保存为 PDF 格式来改进这一点。

我将代码内联,但有点混乱,只需在 Google 中搜索 Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF 您应该会看到很多这样的示例。

另一个更符合您要求的想法是设置通用 PCL 打印机驱动程序(HP LaserJet 4000 或类似)并可编程打开每个文档并打印到默认打印机。诀窍是将它们写入文件。这可以通过几种方式来完成。

使用 Redmon 或类似的东西可以在没有任何用户干预的情况下输出到文件。我们有一个在 XP, 2003 上运行的工具,允许附加到我们在一个非常相似的实例中使用的文件,我们每天需要将 9000 个打印作业连接在一起(如果您感兴趣,我可以发送一个链接)。

另一种方法是使用或编写一个快速捕获工具,捕获端口 9100(或 LPR 的 515)上的数据并将该数据写入文件。该应用程序变成了打印机,然后您就可以走了。

如果您需要上述项目的任何代码,请添加评论,我可以将它们粘贴进去。

I agree with pipitas that a workable solution of the existing process could work well. Depending on how they are saving to Word format, you could improve that by using the 'save as' function programmability to save as PDF format.

I'd put my code inline but it's a bit of a mess, simply search Google for Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF and you should see lots of examples of this.

Another thought more in line with your request, is to setup a generic PCL printer driver (HP LaserJet 4000 or similar) and programmability open each document and print to the default printer. The trick is to write those to a file. This can be done in a couple of manners.

Use Redmon or something similar to allow for output to file without any user intervention. We have a tool that works on XP, 2003 that allows for appending to file that we have used in a very similar instance where we need to concatenate 9000 print jobs a day together (I can send a link if it interests you).

The other is to use or write a quick capture tool that captures data on port 9100 (or 515 for LPR) and writes that data to file. The application becomes the printer and away you go.

Add a comment if you want any code for the items mentioned and I can paste them in.

折戟 2024-09-13 15:59:37

大多数人都急于将 PCL 转换为 PDF,因为他们不知道有可以索引、排序、合并和编辑 PCL 打印流的工具。他们知道有 PDF 文件,但没有 PCL。

如果打印为 PDF,您将失去 PCL 中的纸张处理功能。如果您只是连接 PCL 文件,您可能无法以正确的排序顺序获得它们,并且您可能需要插入用于插入或折叠设备等的 OMR 标记/条形码。

PCLTool SDK - 选项 V,它是 PCLXForm.exe 的许可证。 PCLXForm 是一个 Windows 控制台程序,具有强大的脚本编程语言,具有命令行覆盖和运行时包含功能。 SDK 附带的 Port Monitor 和 HotDir 打印捕获实用程序可以捕获、重定向和累积多个打印流。但是,它也可以查看它们的内部并确定它们需要的正确顺序,将它们转换为 PCL。 (或者,带有书签、内部/外部索引、与其他文档合并等的 PDF)。它还可以将文档分类到1-7页、8-15页等文件夹中。并且,用于邮寄设备的适当 OMR/条形码或插入徽标以使文档更像 TransPromo。该演示位于 www.pagetech.com

Most people are in too much of a hurry to convert PCL into PDF because they are not aware that there are tools that can index, sort, merge and edit PCL print streams. They know there are for PDF files, but not for PCL.

If you print to PDF you lose the paper handling features that would have been in the PCL. If you just concatenate PCL files, you might not get them in the correct sort order and you may want to insert OMR marks/barcodes for insertion or folding equipment, etc.

PCLTool SDK - Option V, which is a license for PCLXForm.exe. PCLXForm is a Windows console program that has a powerful script programming language with command line overrides and runtime include capabilities. The Port Monitor and HotDir print capture utilities that come with the SDK can capture, redirect and accumulate multiple print streams. However, it can also look inside them and determine the correct order they need to be in, convert them to PCL. (or, PDF with bookmarks, internal/external indexes, merged with other documents, etc.). It can also sort the documents into 1-7 page, 8-15 page, etc. folders. And, the appropriate OMR/Barcodes for mailing equipment or insert logos to make the document more TransPromo-like. The demo is at www.pagetech.com

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