Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CUPS filter: binary data before %%EndSetup ?



In my PDE I put several key/value pairs in the jobticket, which my CUPS filter then should inject into the PostScript stream.
My first attempt was to read lines from stdin with fgets (and write them to stdout with fputs) until I find a line which starts with "%%EndComments", Here I would inject some PostScript code, write the line itself, then search for "%%EndSetup", inject even more, and afterwards just copy the rest of stdin to stdout.

However, there are Macintosh applications which generate their own PostScript when printing and use 0x0D as newline, not 0x0A which fgets expects. Also fgets cannot deal with binary data since it stops when it reads 0x00. So I changed my code to use fread and fwrite instead.

But I am afraid there might be binary data (e.g. some 15MB japanese font) in the PostScript stream before "%%EndSetup", which by chance could contain the bytes 0x2525456E645365747570 (aka %%EndSetup) - in which case I would inject my PostScript code at the wrong place.

Is this possible at all (binary data before %%EndSetup)?
If yes, since ANY filter should have this problem, does every developer have to write his own full fledged PostScript parser to find the correct injection points or are there any OS routines / library calls which do this?

Our RIP firmware guys just told me, that some Adobe PageMaker versions even had the nasty habit to nest a printing job with several pages INTO a printing job with one page, so when their parser stumbled on "%!" without a leading "%%BeginDocument" or "%%BeginData" they made a special treatment for it, clearing all options and trying to read them again from the inner job. Phew!


Marc Stibane
Fesh! email@hidden
Kurf|rstenstr. 154 +49-30-39902690
10785 Berlin +49-173-6522422
_______________________________________________
printing mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/printing
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.