English 中文(简体)
无法用Java印刷服务印刷PNG文档(每台工作重罚)
原标题:Unable to print PNG files using Java Print Services (Everything else works fine)

我正在利用贾瓦印刷服务印刷一个PNG文件,然而,它却向打印机发送了错误产出。 实际印刷的(我使用巴布亚新几内亚)是一些文字:

ERROR: /syntaxerror in --%ztokenexec_continue--
                Operand stack:
                              --nostringval-

似乎还有一些文字,但这是从页数中损失的类型。 我将多克弗拉托列到DocFlavor.INPUT_STREAM.PNG,具体文件实际上是。 InputStream (Just changing the DoccFlavor to DocFlavor.INPUT_STREAM.PDF and using a pdf file work).

我也用不同的PNG档案对其进行审判,但问题依然存在。 对于其价值来说,甚至《邮政》也似乎正在发挥作用。

正在印刷的错误与<条码>gd(或图像Magick?)的错误相当相似。 因此,我现在最好的假设是,从PNG(>)转变,PS正在失败。

该法典如下:

PrintService printService = this.getPrintService("My printer name");

final Doc doc = new SimpleDoc(document, DocFlavor.INPUT_STREAM.PNG, null);
final DocPrintJob printJob = printService.createPrintJob();

这里,getPrintservice fetches a press services and is fetching a valid. 关于<条码>文件,下面是我如何做到:

File pngFile = new File("/home/rprabhu/temp/myprintfile.png");
FileInputStream document = new FileInputStream(pngFile);

我没有怀疑它为什么会错,我也没有看到任何错误也会给圣公会带来。

非常感谢任何帮助。 感谢。

问题回答

印刷总是一件大事——必然如此,因为你不得不担心页数、差幅以及你需要多少页才能产出等令人不安的细节。 如你所期望的那样,图像印刷过程不同于印刷文本,而且你可能会使一些具有不同能力的打印机更加复杂,因此,需要选择适当的打印机。

请参看以下链接:

http://vineetreynolds.wordpress.com/2005/12/12/silent-print-a-pdf-print-pdf-programmatically/ http://hillert.blogspot.com/2011/12/java-print-service-frustrations.html





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签