Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to catch %%Page: with Acrobat distiller ?

Status
Not open for further replies.

GordonIt

Programmer
Oct 7, 2005
22
CA


How can I track %%Page:
I mean, how can I execute a predefined section of PS code I would put in prologue.PS, and get the data section of the comments, (from : to <cr>), during a distiller interpretation phase ?

%comments line , including DSC comments, are not operator that can be 'replaced' by method I know

As DSC comments like %%Page: nn mm is already tracked by distiller when it do the DSC warning, there might be a more elaborate internal process for % line, but how to 'register' my procs ? Others rip have various custom method like, a special dict where %%Comments can be defined with a << /Comments {myproc} >> .
Does distiller have one ?
If yes do you know if it is called Before or After distiller internal DSC checkup ?

Thanks





 
You don't need to hook into comments in order to create PostScript procedures.

If you want a procedure to run on every page, you can write a /BeginPage or /EndPage procedure.

You can even overload (redefine) showpage itself, if you must.

I'm unclear what you're trying to do...

Thomas D. Greer
 

Thanks

Let's clarify myself.
First I am used to write PS code for PS Rip like GS,Harlequin, or Jaws. As procset or pagefeature, or driver init procs.

But distiller is a close but different beast, and I can't use it the way I need.

As an example I need to track rather unusual comments values like
%%Page: (Logo CRAZY STARS\(new\)) 17
or
%%Page: logoPRESENCE.eps 45
or
%%PlateColor: PANTONE S 257-3

Distiller do it's own interpretation of theses values to feeds PDF PageLabelDict /St /D, /P.
BUT I need the original strings. I can't only use the PDF page label, which would require anyway a post processing to catch theses infos.


I am used to catch them on 5D Jaws and Harlequin Scriptworks within procsets I successfully wrote.
Theses 2 products have a special dictionary where I can define a comment to catch using /Key {proc} pair, then they interpret the comments and call my procs with a string as arguments.
Then I can do whatever I need to do with it (store it to a file in my case)

For example on Harlequin ScriptWorks typically this work like

They use (%%string) in place of /key to allow %%, for interpreter it's same beast.

(%%dict) load (%%actions) get begin
/Page: {(Page: Found , value is <) print print (>)=} def
/ PlateColor: {(PlateColor: Found , value is <) print print (>)=} def
end

output on stdout would then be

"Page: Found , value is <Logo CRAZY STARS(new) 1>"

In fact procs I do is more elaborate in order for my own procs to be concatenated to any already existing procs that another procset may have already setup.

Once that said.

How can I do to setup "something" in distiller to have my own procs being called each time this comments is found.
Best would be that I can get the arguments directly as a string as I can do with Jaws and HQ rip..
Otherwise I plan to seek within currentfile to seek back fetch the line and reseek to saved position to resume interpretation (tedious..)

/BeginPage /EndPage are not a solution as they are called just before and after showpage, could be rather far away from (time and position) of the comments. %%Page is before %%BeginPageSetup and even worst Quark use it's own convention using %%QRKPageBegin: that happens after %%EndPageSetup.


So have you heard of a way to do that with distiller ? How ?

Thanks




 
No, I haven't. I think you'll have to write something using "currentfile". My approach would be to write a procedure that "read" the current program into an array of strings, until you find what you want. Then, execute those strings, to build the page image. Then continue until the end of the file.



Thomas D. Greer
 
Thanks, I heard of somebody that did a pre-separated to Composite "re combiner" for distiller,
This surely need to catch %%Platecolor: BEFORE sending it to distiller in order to allow a recombine changing color model from gray (for this layer) to a /Separation for the Platecolor string.

How do they do that ? have you heard of that ?
One important question for me is to know if a method exists.
If not then I stop investigating and start coding ;-)
finding another method as you suggest.
Adobe documentations (even ASDN I have with me) are not giving any clear clue on whether or not it can be done. Distiller is a poor parents, too bad I think it's a marvelous piece of tech.

So if you ever hear something...

Thanks again I visited your web site and really appreciate your works.
 
Consider Ghostscript. Among other things it can run associate
user's procedures with DSC comments.

Re DCS to composite conversion, it is rather sifficult.
In may opinion, the easiest way is to render the separations
into a raster images and combine them.

You can try to use /Separation trick but the file will remain
pre-separated. Most likely, the separations will bypass
any color correction on the rip.

Your PostScript expert is just a click away.
 
Thanks
But I unfortunately need to use Distiller.

I do not intend to specially reconstruct separated PostScript but this would be a funny project anyway.
For now I just need to register special page name and %%Platecolor name used within documents.
Page name is more important (%%Platecolor name is frequently of the exact name in the PDF as it's a /Key without limitation)

I was just mentioning a work I heard of that most probably require to track the %%Platecolor:
It's thread thread280-753668 were a guy nicknamed Golan Trevize mention a work he did, but can't show the code. So I assume that the probability that it can be done is very high, but how ? ;-)


Wait and see... unless you know Golan or somebody who know.

Thanks
 
You can always preprocess your files by a small sed/Perl/C program. Use dscparse.c from Ghostscript as an example of a general-purpose DSC parser.

A pure Distiller solution requires a DSC parser implemented in PostScript. You can use reusable streams to store large chunks of data. Unfortunately, the DSC structure is often incorrect. The parser will need a lot of testing.


Your PostScript expert is just a click away.
 
Thanks Alex (with delay)
Without any other solutions I did implement PS parsing in prologue!! finaly

FYI What I did and finding were;

But I dislike this pre-processing as my customer sometime have file 2GB big. .... and I get the classical "OK it work but have you seen how fast it can be without your code ?? " ;-) )

I find out (don't take it as a rule) that's it better to NOT use Reusable filter, because distiller do a worst job (but not bad!) than the OS itself on very big file due to caching by the OS, on my machine, a general rule ? I don't know

Also to mention:
/DSCReportingLevel 0 in job.options dict, it's not that well documented (and not user accessible) but it DO! real time display of DSC. Funny to see it working!

However (and may be somebody have a solution) It only output to stdout and I don't know how to redirect stdout in a file on distiller. Do you know ?
(standard method doesn't work, /stdout is in serverdict and is ROnly when prologue start. RW in distinit.ps but it looks like before session serverdict is "reset" by distiller internally (make sens anyway)

DO you have a way to redirect this output to some stream or file or string or ... that I can check during execution (by diverting few opps like showpage)
I don't need any display on distiller so 100% redirect is OK I can even filter and use the old /stdout file if I need.






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top