Is there a way to fix a PostScript file error?
I am using Print Distributor to write PostScript files to disk and then reprint them to a printer. When an error occurs no pages after the error are printed but the file size seems to reflect that all of the page data is there. Is there any way to find the error and fix it so I can print the entire file?
I am using GSView to view the postscript and the error I am gettin开发者_JAVA技巧g now is:
ERROR: ioerror OFFENDING COMMAND: image STACK:
Any ideas?
Some things to consider or try:
Does the document print if printed directly to the printer? In other words, is the intermediate step of writing to disk introducing some error?
If the document still will not print, then you have a document which is incompatible with your printer's PostScript processor in some manner. It may be a version mismatch or an element within the PostScript that is not understood by the printer. It's also entirely possible that the generated PostScript is malformed due to a corrupt element, such as an image, which the error message suggests. You could try printing the document without images to see if it works.
If the document does print directly, then the intermediate step is introducing the error. It may be a formatting issue, character encoding issue or similar problem. If you are able, compare the raw data when printing directly to see what the discrepancy is.
Ultimately, PostScript is it's own programming language with a steep learning curve. Unless you are generating your own code for printing or describing print media, I don't recommend tweaking it.
I was able to fix the problem. The postscript file contained multiple documents. I wrote a program to split the PS file into multiple PS files so I had one file per document. I then wrote another program to validate all of the split out PS files using GhostScript and delete invalid documents. I then wrote another program to concatenate all the PS files back together. Now it works and I now know more about PS and PS utilities then I ever wanted to.
精彩评论