将 PCL 转换为 PDF

发布于 2024-07-15 07:10:40 字数 116 浏览 4 评论 0原文

我希望创建(作为概念验证)一个 OCaml(最好)程序,将 PCL 代码转换为 PDF 格式。 我不知道从哪里开始。 是否有这样做的标准化算法? 对于完成这项任务还有其他建议吗?

谢谢!

I am looking to create (as a proof-of-concept) an OCaml (preferably) program that converts PCL code to PDF format. I am not sure where to start. Is there a standardized algorithm for doing so? Is there any other advice available for accomplishing this task?

Thanks!

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

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

发布评论

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

评论(2

雄赳赳气昂昂 2024-07-22 07:10:41

Ghostscript 开发人员最近将其姐妹产品 GhostXPS、GhostPCL 和 GhostSVG 集成到他们的 Ghostscript 源代码树 。 (它现在称为GhostPDL。)因此,现在可以从那里使用所有这些附加功能(加载、渲染和转换 XPS、PCL 和 SVG)。

这意味着您可以从他们的源代码构建他们的语言切换二进制文件。 理论上,这可以使用 PCL、PDF 和 PostScript,并将其转换为许多其他格式。 虽然它在我需要时对我有用,但 Ghostscript 开发人员建议停止使用语言切换二进制文件(因为它“几乎不受支持”——请参阅 KenS 对此答案的评论),而是切换到使用显式二进制文件 pcl6.exe(PCL 输入)、gsvg.exe(SVG 输入,也“几乎不受支持”)和 gxps.exe(支持状态不清楚)我)。

因此,要将“将 PCL 代码转换为 PDF 格式” 作为请求区域,您可以使用 pcl6 命令行实用程序,它是一个姐妹产品到 Ghostscript 的 gs/gswin32c.exe

示例命令行:

 pcl6.exe  \
  -o output.pdf  \
  -sDEVICE=pdfwrite  \
   [...more parameters as required (optional)...]  \
  -f input.pcl

根据 KenS 在评论中的提示更新...

Ghostscript developers have recently integrated their sister products GhostXPS, GhostPCL and GhostSVG into their Ghostscript source code tree. (It's now called GhostPDL.) So all of these additional functionalities (load, render and convert XPS, PCL and SVG) are now available from there.

This means you could build their language switching binary from their sources. This, in theory, can consume PCL, PDF and PostScript and convert this to a host of other formats. While it worked for me whenever I needed it, Ghostscript developers recommend to stop using the language switching binary (since it's 'almost non-supported' -- see KenS' comment to this answer) and instead switch to using the explicit binaries pcl6.exe (PCL input), gsvg.exe (SVG input, also 'almost non-supported') and gxps.exe (support status unclear to me).

So to 'convert PCL code to PDF format' as the request areads, you could use the pcl6 command line utility, a sister product to Ghostscript's gs/gswin32c.exe.

Sample commandline:

 pcl6.exe  \
  -o output.pdf  \
  -sDEVICE=pdfwrite  \
   [...more parameters as required (optional)...]  \
  -f input.pcl

Updated as per KenS' hints in the comment....

若无相欠,怎会相见 2024-07-22 07:10:40

PCL 到 PDF 的转换可能非常复杂(假设您需要它是通用的,而不仅仅是简单的 PCL)。 我们对此进行了多次投资,最终总是转而使用其他工具。 我们不断进行调查,因为我们是一家开发公司,非常详细地使用和了解 PCL 的所有元素。 如果您不太熟悉 PCL,这将是一项艰巨的任务。 主要问题之一是,随着时间的推移,打印机在很大程度上已经变得能够容忍格式错误的 PCL,因此,创建遵循法律条文规则的东西并不总是足够的。 如果; 然而,如果您可以控制 PCL,您也许能够在一定程度上成功地解决它。

我并不是想让你放弃这个,我意识到你来这里是为了寻找编程答案,但我不得不说,这远非简单的任务,而且没有“标准化算法”(即我知道)。

如果这是一个与您正在构建的其他东西一起工作的工具,我强烈建议您看看这些人:

PageTech

这是迄今为止用于处理此问题的最完整的工具集(Windows)。 还有其他一些工具,但根据我们多年来对 PCL 和转换工具的广泛使用,这是唯一始终有效的工具。

编辑:最近我们一直在与 LincPDF (http://www.lincolnco. com/)。 这也是一款优秀的产品,有一大优点,部署简单。 其他一些工具具有复杂的软件安装。 这个解决方案对于我们来说非常容易部署为应用程序中的一项功能。 它也比我们迄今为止测试过的任何工具都要快(至少对于我们从应用程序生成的 PCL 而言,它非常复杂,因为它们包含专用字体和宏)。

Conversion of PCL to PDF can be incredibly complex (assuming you need it to be generic and not just for simple PCL). We've investaged this many times and in the end always revert to using other tools. We keep investigating as we are a development shop who uses and understands all elements of PCL to great detail. If you are not really familure with PCL it will be daunting task. One of the major issues is that overtime, printers have become, for the most part, tollerent of malformed PCL and as such, creating something that follows the rules to the letter of the law is not always sufficient. If; however, you have control over the PCL, you may be able to work it out with some amount of success.

I don't mean to turn you off of this and I realize that you've come here looking for a programming answer but I have to say, this is a far from simple task and there are no 'standarized algorithms' for this (that I'm aware of).

If this is designed to be a tool to work alongside of somehting else you are building I'd highly recommend looking at these guys:

PageTech

This is by far the most complete set of tools (Windows) for handling this. There are a few others but, based on our extensive use of PCL and conversion tools over the years, this is the only one that work all the time.

EDIT: Most recently we've been working with LincPDF (http://www.lincolnco.com/). This is also an excellent product with has one big benefit, deployment is simple. Some of the other tools have complex software installations. This solution is very easy for us to deploy as a feature in an application. It's also faster then any tools we've tested to date (at least with the PCL that we generate from our apps which is quite complex as they include specialized fonts and macros).

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