将 pcl 转义序列插入由多个 PDF 文件构建的 PCL 中

发布于 2024-07-30 18:16:44 字数 316 浏览 3 评论 0原文

有哪些工具/方法可用于从 PDF 构建 pcl 流。

我们有一堆生成的 PDF 文件,这些文件被捆绑成一个大 pdf。 我需要生成一个打印作业来打印此内容,并且能够在每页插入 pcl 转义序列(以控制进纸和出纸盒堆叠)。 目前我们使用VB.Net打印类,使用第三方工具将PDF转换为光栅化图像进行打印。 这不允许我们将 PCL 序列插入到打印作业中。

因此,基本上,我们需要处理一堆 PDF,将它们附加到 pcl 并在处理过程中插入 PCL 命令。 有没有办法实现这一点。 我们的应用程序是用 VB.Net 编写的。

非常感谢任何建议。

What tools/methods are available to build pcl stream from PDFs.

We have a bunch of generated PDF files that get tied up into one big pdf.
I need to generate a print job to print this with the ability to insert pcl escape sequences (to control paper feed and output bin stacking) per page. As of now we use the VB.Net printing classes, convert the PDF into a rasterized image using a third party tool to print. This does not allow us to insert PCL sequences into the print job.

So, basically, we need to process a bunch of PDFs, append them to the pcl and insert PCL commands as we go along. Is there a way to achieve this. Our application is written in VB.Net.

Any suggestions are greatly appreciated.

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

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

发布评论

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

评论(2

源来凯始玺欢你 2024-08-06 18:16:44

PCL 和 PDF 是完全不同的语言,您不能将一种语言插入另一种语言中。 如果我有所有的细节,我可能会推荐一些不同的东西; 但是,根据您的描述,我建议使用 Ghostscript(使用 ljet4 或它包含的其他 PCL 输出“设备”),然后您可以附加/添加控制托盘等所需的任何 PCL 命令数据。请记住,您可能无法简单地插入托盘选择在顶部,您需要移动到 PCL 流中的适当位置并执行此操作,例如在 E 之后。这样做

的一个主要缺点是 PCL Ghostscript 创建的基本上是每页一个大图形,因此它根本没有效率,并且不提供您在 PCL 中搜索的能力 最终

您尚未提供可能有助于推荐更具体内容的详细信息,包括:

  • 目标是什么,在 XYZ 设备上打印 PDF,转到特定托盘并输出?
  • 您需要将其“分解”为多个文档吗?
  • 整个文档中的托盘选择是否发生变化?
  • 文档是混合尺寸的还是全部相同尺寸的纸张?
  • 该设备还支持哪些其他“语言”? 例如 PS/PCL/PCL-XL/PDF/TIFF/HTML/JPG...
  • 您想使用 PCL 是因为必须还是因为您习惯使用它?

您可以使用的其他选项包括:

  • 将 PDF 转换为 PCL 或 Postscript,并在作业开始时插入适合该打印机的 PJL 命令。
  • 在 PDF 文档的开头插入 PJL(假设打印机可以本机打印 PDF)并将其直接发送到设备

编辑:根据与 InnocentDev 的讨论添加更多详细信息

抱歉更新了回复,看起来您已经由你来解决。

如果最终结果是获取 PDF 文件并转换为打印打印机可以理解的文件,同时在已知位置插入托盘选择命令,那么我认为有 2 种解决方案。 您可以将其转换为 PCL 或 Postscript。 Postscript 可能更容易,因为 PCL 使用 FF(换页)控制代码来分隔每个页面,并且 FF 字符可能在字体声明和/或图形图像期间出现在整个页面中。

如果您通过单独拆分页面或执行一些额外的工作来确定 FF 实际上是分页符而不是字符的其他实例之一,甚至找到其他元素来管理 FF 上的文档中断您可以继续使用(Ghostscript 在每个页面的开头可能有一些其他代码这是一致的,我不是 100% 确定)。 另一种方法是使用 Ghostscript 甚至 pdftk,将每个页面转换为PCL,插入命令并将页面连接在一起; 然而,根据我之前关于从 PDF 转换为 PCL 的评论,您最终可能会得到一个非常大的输出文件。 这不会影响设备的打印性能,但可能会减慢数据传输速度等。

如果您采用 PCL 路线,转换完成后,您只需在开始时将用于纸盘选择的适当 PCL 命令添加到文档中的每个页面每页的。

<esc>&lxH where x is the tray number.  

这有一些标准; 但是,具有超过 3 个纸盘的设备通常不遵循这些标准,并且随着时间的推移,当 HP 决定将多用途纸盘从多用途进纸器重新映射到纸盘 1 时,它们会发生一些变化。检查您的设备文档或安装他们的 PCL 打印驱动程序并将文件打印到您希望输出到的托盘,您可以看到他们使用的编号。

如果您使用 Postscript,您也可以执行相同的操作,但打破页面可能会更容易,因为您可以拆分文档(或至少查找)命令,例如:

%%Page: x x
%%BeginPageSetup

这些命令始终出现在 Ghostscript。 找到它们后,您可以在页面设置期间插入 Postscript MediaSource 命令并完成相同的操作。 您甚至可以使用 Postscript 命令来设置介质类型或介质颜色。 有一些通用命令可用于此目的,但您可能需要使用特定于要输出到的设备的命令。 您可以随时查看设备文档、他们的 PPD 文件,或者我经常做的就是从他们的驱动程序中打印到文件,并查看他们如何实现编码。

PCL and PDF are completly different languages, you cannot insert one into the other. If I had all the details I might recommend something different; however, based on what you have described I'd suggest converting the PDF documents to PCL using Ghostscript (using the ljet4 or other PCL output 'device' it includes) and then you can append/prepend any PCL commands data you need to control trays etc. Keep in mind that you probably won't be able to simply insert tray selections at the top, you'll need to move to an appropiate spot in the PCL stream and do this such as, after the E.

The one major downfall with this is that the PCL that Ghostscript creates is basically one large graphic per page so it's not effecient at all and doesn't provide you the ability to search in the PCL for text etc.

Things you haven't provided detail that might help recommend something more speicific include:

  • What is the ultimate goal, to have a PDF print on XYZ device, going to a specific tray and output?
  • Do you need to 'burst' this into multiple documents?
  • Does trays selection change throughout the document?
  • Is the document of mixed size or all the same size paper?
  • What other 'languages' does the device support? Such as PS/PCL/PCL-XL/PDF/TIFF/HTML/JPG...
  • Do you want to use PCL because you have to or because you are comfortable with it?

Other options you could use include:

  • Converting the PDF to PCL or Postscript and inserting PJL commands appropiate for that printer at the start of the job.
  • Inserting PJL at the start of the PDF document (this assumes that the printer can print PDF natively) and sending it strait to the device

EDIT: Adding further detail based on a discussion with innocentDev

Sorry for the late updated response, looks like you've sorted it out on your end.

If the end result is to take a PDF file and convert to something print printer understands while inserting tray selection commands at know spots then I think there are 2 solutions. You could do this as a conversion to PCL or Postscript. Postscript may be easier for the fact that PCL uses a FF (formfeed) control code to break each page and the FF character might appear throughout the page during a font declaration and/or graphic image.

If you do manage the break the document on the FF by splitting pages out of the individually or doing some extra work to determine that the FF is actually a page break and not one of the other instances of the character, or even finding some other element that you can break on (Ghostscript may have some other code at the start of each page that is consistent, I'm not 100% sure). Another way is to break the document into pages using Ghostscript or even pdftk, convert each page to PCL, insert the commands and concatenate the pages together; however, based on my previous comments regarding convert from PDF to PCL you might end up with a very large output file. This shouldn't impact print performance of the device but may slow data transmission etc.

If you go the PCL route, once you have it converted you simply need to add the appropriate PCL command for tray selection to each page in the document at the start of each page.

<esc>&lxH where x is the tray number.  

There are some standards for this; however, devices with more than 3 trays often don't follow these standards and they've change a little over time as HP renumber things when they decided to remap the multipurpose tray from a multipurpose feeder to tray 1. Check your devices documentation or install their PCL print driver and print to file to the tray you want it to output to and you can see what number they use.

If you go Postscript you can do the same but breaking the pages may be easier as you can split the doucment (or at least look for) commands such as this:

%%Page: x x
%%BeginPageSetup

These always appear in Postscript output from Ghostscript. Once you find them you can insert a Postscript MediaSource command during the page setup and accomplish the same thing. You could even use the Postscript commands for media type or media colour. There are some generic commands for this but you might need to use something specific for the device you are outputting to. You can always review the device documentation, their PPD file or, what I often do, is print to file something from their driver and look at how they implement the coding.

℉服软 2024-08-06 18:16:44

PCLTool SDK - 选项 V 使用 PCLXForm.exe 和自定义 .TPT 脚本,是唯一可以对 Windows 打印机驱动程序生成的复杂 PCL 进行流式编辑的产品。

该演示位于 www.pagetech.com。 然而,由于需要 PCL 和 SDK 流编辑功能的专家级知识。 PageTech 可能需要根据您的要求编写自定义脚本。 如果 PCL 打印流发生变化,您可以编辑 ASCII 文本脚本。

血压

PCLTool SDK - Option V using PCLXForm.exe with a custom .TPT script is the only product that can streamedit the complex PCL generated from a Windows printer driver.

The demo is at www.pagetech.com. However, due to the need for expert level knowledge of PCL and the SDK stream edit functions. PageTech will probably have to write the custom script to your requirements. The ASCII text script would be editable by you should the PCL print stream change.

BP

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