Java – validate postscript without trying to print it?

Saving data to postscript in my application will generate a postscript file that I can view in ghostview without problem, but when I try to print it, the printer cannot print it because it seems invalid

Is there a way to verify / find errors in postscript files without actually sending them to the printer? Some kind of Java API / library is preferred, but programs that perform the same operation can also be used

Editor #1: No, I don't know why it's invalid, or even not necessarily invalid, but I hope I can verify it outside ghostview, or find out what happens when it can't print

A: using the ps2ps technique, I can see the output of postscript and check the differences The difference is that I don't allow decimal numbers for the width or height of the image in postscript, but only integers So I still haven't found a verification method, but this method is enough for my problem thank you.

Solution

If you can see it on ghost view, it means ghost script can parse it

So, one trick you can try to print (but not actually verify) your files is to use the postscript output mode of ghostscript (there is a wrapper named ps2ps, which mainly adds - sdevice = pswrite; and ps2ps2 uses - sdevice = ps2write)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>