Mailing Lists: Apple Mailing Lists

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

Re: CUPS filter: binary data before %%EndSetup ?



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.

If you need to parse for arbitrary DSC comments such as %%EndSetup you should always be parsing for the sequence:

<newline>%%EndSetup<newline>

where <newline> can be <cr>, <lf> or <crlf>

Since DSC comments always appear after a newline (or with the %!PS-Adobe-xx which is the first sequence in the file), this is a better approach.

OK. But what if the binary data sequence 0x0D2525456E6453657475700A (aka <cr>%%EndSetup<lf>) appears in the PS stream before the _real_ %%EndSetup?
Or if the print job includes an EPSF, which of course has an %%EndSetup?
I guess I have to search for "%%BeginDocument" or "%%BeginData" also...
Is there any other delimiter which includes external data (binary or ASCII)?
_____

If you need to make a feature or features available for your printer that require collecting data from the user beyond hard coded features that can be well described by the standard PPD syntax you can have your PPD describe a feature that causes invocation code to be added to the print stream that you can parse for in your filter.
--snip--
You should have a pretty easy time parsing for this sequence and perform the appropriate replacement in your filter. This should make your filter's job significantly easier and avoid the general parsing difficulties you might otherwise encounter.


Thanks for this suggestion, but this is waaayyyy too complicated. Currently we have about 30 PPD entries with "hard coded features" (can be put in a popup menu) and about 20 features which we cannot put in the PPD because they have no pre-defined values, e.g. an email address (our RIPs can send email to an administrator's address when something goes wrong) or some floating point numbers. I always inject all those 20 features just before %%EndSetup, so I just need to find the correct one. Only ONE injection point, so the parser should be as simple as possible.
_____

BTW, how would you put a string containing spaces into the job ticket? I ended up encoding them like a browser address (%20) and decoding them in my CUPS filter. Doesn't look pretty if you open the saved settings with the plist editor.

Thanks

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.


References: 
 >CUPS filter: binary data before %%EndSetup ? (From: Marc Stibane <email@hidden>)
 >Re: CUPS filter: binary data before %%EndSetup ? (From: David Gelphman <email@hidden>)



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.