简体   繁体   English

使用Java将PDF(1.4和1.5)可靠地打印到网络打印机

[英]Reliably print PDF (1.4 and 1.5) to a network printer using Java

I've been using the solution detailed in this question (including jLpr ) to print PDF documents to a network printer. 我一直在使用此问题中详细介绍的解决方案(包括jLpr )将PDF文档打印到网络打印机。 However, I've run into some problems with PDF version compatibility. 但是,我在PDF版本兼容性方面遇到了一些问题。

When I print documents that are PDF 1.4, it comes out fine. 当我打印PDF 1.4文档时,结果很好。 (To reproduce, create a simple text document in OpenOffice and export it to a PDF.) But when I print PDF 1.5 documents, the output is just jarbled text--no readable PDF. (要进行重现,请在OpenOffice中创建一个简单的文本文档,然后将其导出为PDF。)但是,当我打印PDF 1.5文档时,输出的只是文本混乱的文件,而不是可读的PDF。

It appears that jLpr isn't able to handle PDF 1.5 documents (either that or something is going wrong with the transmission or its decoding at the printer). 看来jLpr无法处理PDF 1.5文档(在打印机上传输或解码时出现问题或出现问题)。

As in the question I referenced, I need a cross-platform solution with as few dependencies as possible. 就像我提到的问题一样,我需要一个跨平台的解决方案,其依赖关系应尽可能少。 How can I get jLpr to work? 我如何才能使jLpr工作? Are there better ways to do it? 有更好的方法吗?

This has nothing to do with Java. 这与Java无关。 The java library is just sending the PDF to your printer. Java库只是将PDF发送到您的打印机。 And if your printer can't handle PDF 1.5, it can't handle 1.5. 而且,如果您的打印机不能处理PDF 1.5,那么它就不能处理1.5。 Javalpr isn't a postscript interpreter, it's just a network client for the LPR protocol for sending stuff to printers. Javalpr不是PostScript解释程序,它只是发送东西打印机LPR协议的网络客户端。

Java can't print PDF unless the printer supports PDF natively. 除非打印机本身支持PDF,否则Java无法打印PDF。 You need to use a hack or a PDF renderign library to rasterize it. 您需要使用Hack或PDF renderign库对其进行栅格化。 We wrote an article on PDF printing in Java at http://www.jpedal.org/PDFblog/2010/01/printing-pdf-files-from-java/ 我们在http://www.jpedal.org/PDFblog/2010/01/printing-pdf-files-from-java/上写了一篇有关Java用PDF打印的文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM