PDF 到 PCL 转换

发布于 2024-07-30 00:05:23 字数 309 浏览 3 评论 0原文

在我的 Java 应用程序中,我最终需要将 PDF 文件转换为 PCL 并发送到 RightFax 服务器。 我还需要在 PCL 文件中嵌入代码,RightFax 将读取这些代码以了解将传真发送到何处。

这样做的最佳方法是什么?

网上搜索了一下,好像可以使用Java的StreamPrintService将PDF文件打印到PCL。 它是否正确? 这是否也意味着我必须在操作系统上安装可以解释 PCL 的打印机?

生成 PCL 文件后,我需要在文件中添加嵌入代码。 我是否将代码添加到文件末尾(通过用 Java 打开文件并写入)?

In my Java application, I have PDF files that I eventually need to convert to PCL and send to a RightFax server. I'll also need to embed codes in the PCL files that RightFax will read to know where to send the fax.

What's the best approach towards doing this?

Searching online, it seems like I could use Java's StreamPrintService to print the PDF files to PCL. Is this correct? Does this also mean that I must have installed on my OS a printer that can interpret PCL?

Once the PCL file is generated, I need to add the embedded codes in the file. Do I add the codes to the end of the file (by opening it in Java and writing out to it)?

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

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

发布评论

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

评论(4

凉城 2024-08-06 00:05:27

打印到文件似乎是正确的方法。

print-to-file seems to be the right approach here.

心的憧憬 2024-08-06 00:05:26

JPS 允许您打印到文件,因此您只需在 PCL 打印机上打印到文件即可。

JPS lets you print to file so you just need to print to file on a PCL printer.

寻梦旅人 2024-08-06 00:05:25

我们有一个非常相似的过程。 我们所做的是拥有一个 pcl 文件和一个控制文件(其中包含 rightfax 指令的文本文件)。 我们使用 java NIO 连接这两个文件并将其发送到 rightfax 打印队列。 我们基本上创建一个新文件,并使用stream.getChannel()获取的通道中的transferFrom()方法将上述两个内容写入新文件。 我们把控制指令放在顶部而不是像你提到的那样放在底部? 可能是你说错了 - 我认为 Rightfax 需要它在顶部。 我不得不承认我没有尝试在底部发送它。 也许它会起作用只是不知道。

We have a very similar process. What we do is we have a pcl file and a control file (a text file with the rightfax instructions in it). We concatenate these two files using java NIO and send it across to the rightfax print queue. We basically create a new file and write the above two into the new file using the transferFrom() method in the channel which is got by stream.getChannel(). We put control instructions at the top not at the bottom as you have mentioned? may be you misstated it - I think Rightfax needs it at the top. I have to admit I have not tried to send it at the bottom. May be it will work just dont know.

掩耳倾听 2024-08-06 00:05:25

恕我直言,最简单的解决方案是将 PDF 放入 RightFax 服务器上的文件夹中。 然后使用嵌入式代码或 FCL(传真命令语言)创建一个小文本文件,其中包含有关将文档发送给谁等的所有说明。 我们一直这样做,而且效果很好。 注意:仅当您有集成模块时,传真命令语言才可用。 嵌入式代码和 FCL 都有一个附加文件的命令。 RightFax 收到此文本文件后,它将处理命令并附加 PDF 并传真和/或通过电子邮件发送文档。 以下是两个示例(一个嵌入式和一个 FCL)。

嵌入代码文件:

<TOFAXNUM:999999999>
<TONAME:Douglas Anderson>
<BILLINFO1:12345>
<NOCOVER>
<WHO:DOUG>
<ADDDOC2: C:\pdfFiles\12345.pcl>

FCL 代码文件:

{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{attach C:\pdfFiles\12345.pcl delete}}
{{imagetype pdf}}
{{end}}

将此简单的文本文件发送到 RightFax 将提示其处理并插入您指定的文档。 有各种 ADDDOC 命令和 ATTACH 开关,告诉 RightFax 在发送文件后删除文件等。

嵌入式代码文件可以通过 HPFAX 队列发送,FCL 可以通过生产收件箱发送(c:\程序文件\rightfax\生产\收件箱)。

这提供了很多控制权,并且可以更轻松地进行故障排除,因为您仍然拥有可查看的 PDF(因为您没有在其开头粘贴文本),并且您可以轻松输出嵌入式代码或 FCL 文件到备用文件夹,以便使用记事本等简单工具进行查看甚至修改。


编辑:OpenSource 是正确的,您可以将文件连接在一起,我很长一段时间没有使用嵌入式代码执行此操作(请参阅最后的示例),但已经使用 FCL 执行了类似的操作(如果您有 Ingetration 模块,则可以执行此操作) 。

数据中嵌入 PDF 或 Postscript 的 FCL(RightFax 处理 PS 和 PDF):
{{开始}}
{{传真999999999}}
{{联系道格拉斯·安德森}}
{{billinfo1 12346}}
{{无掩饰}}
{{beginpostscript}}
%PDF-1.3...
...你的pdf...
{{endpostscript}}
{{end}}

PCL 变体如下所示:

{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{beginpcl}}
...your pcl data...
{{endpcl}}
{{end}}

带有嵌入代码的虚假首页(根据我很久以前所做的笔记):

<TOFAXNUM:999999999>
<TONAME:Douglas Anderson>
<BILLINFO1:12345>
<NOCOVER>
<WHO:DOUG>
<DELETEFIRSTPAGE>
*PCL formfeed character*
...your pcl data...

您发送的任何内容都将显示在“首页”上,但这将被删除。 另一种选择是在文档末尾的换页之后发送此数据并使用 选项。 此数据也可以与 PCL 文件本身内嵌显示,因此您可以在作业开始时发送它,而无需使用 命令和换页拆分器。

The simplies solution, IMHO, is to drop the PDF into a folder on the RightFax server. Then create a small text file with all the instructions for who to send the document to etc. using Embedded Codes or FCL (Fax Command Language). We do this all of the time and it works great. Note: Fax Command Languate is only available if you have the Integration Module. Both Embedded Codes and FCL each have a command to attach a file(s). Once RightFax receives this text file it will process the commands and attach the PDF and fax and/or email the document. Here are two examples (one Embedded and one FCL).

Embedded Code File:

<TOFAXNUM:999999999>
<TONAME:Douglas Anderson>
<BILLINFO1:12345>
<NOCOVER>
<WHO:DOUG>
<ADDDOC2: C:\pdfFiles\12345.pcl>

FCL Code File:

{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{attach C:\pdfFiles\12345.pcl delete}}
{{imagetype pdf}}
{{end}}

Sending this simple text file to RightFax will prompt it to process and insert the document you specify. There are vaious ADDDOC commands and switchinges for ATTACH that tell RightFax to delete the file once it has been sent etc.

The Embedded Code File can be sent in via the HPFAX queue and the FCL can be sent in via the Production Inbox (c:\program files\rightfax\production\inbox).

This gives a lot of control and allows for easier troubleshooting as you still have a PDF that is viewable (due to the fact that you didn't stick text at the start of it), and you can easily output the Embedded Code or FCL files to an alternate folder for viewing and even modifying with simple tools like Notepad.


Edit: OpenSource is correct that you can concatenate files together, I haven't done this with Embedded Codes for a long time (see example at end) but have done something similar with FCL (if you have the Ingetration Module you can do this).

FCL with PDF or Postscript embedded in data (RightFax treats PS and PDF):
{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{beginpostscript}}
%PDF-1.3...
...your pdf...
{{endpostscript}}
{{end}}

The PCL variant looks like this:

{{begin}}
{{fax 999999999}}
{{contact Douglas Anderson}}
{{billinfo1 12346}}
{{nocover}}
{{beginpcl}}
...your pcl data...
{{endpcl}}
{{end}}

False first page with Embedded Codes (as per my notes from something we did a long time ago):

<TOFAXNUM:999999999>
<TONAME:Douglas Anderson>
<BILLINFO1:12345>
<NOCOVER>
<WHO:DOUG>
<DELETEFIRSTPAGE>
*PCL formfeed character*
...your pcl data...

Whatever you send will appear on the 'first page' but this will be deleted. The other option is to send this data after the Formfeed a the end of the document and use the <DELETELASTPAGE> option. This data can also appear inline with the PCL file itself and as such you may be able to send it at the start of the job without the <DELETEFIRSTPAGE> command and the formfeed splitter.

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