質問

I am creating a 10000 page postscript file using Apache FOP containing only a person's name per page. I am given a large (4MB) EPS file which should be added to the background of each page. I should create a single output postscript file for printing. Although I can embed the EPS in every page of my postscript (as described in EPSF_SPEC [1]), I would like to embed it once and reference it. Otherwise, 4MB are added for each output page and the final output postscript is huge. Is it possible to do this in postscript ? If yes how ?

I already looked at [2]. I also created them as PDF and added the background once using iText. The size was small but when I converted it to PS using Ghostscript, the size was too large. Finally, FOP can only add the EPS file inline, even when configured with optimize-resources=true.

[1] http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf

[2] Overlay two postscript files (command line approach)?

役に立ちましたか?

解決

You could define the EPS as a form, then execute the form as required. See the PostScript Language Reference Manual, section 4.7:

4.7 Forms A form is a self-contained description of any arbitrary graphics, text, or sampled images that are to be painted multiple times, either on several pages or at several locations on the same page. The appearance of a form is described by a PostScript procedure that invokes graphics operators. Language support for forms is a LanguageLevel 2 feature.

Note that the Ghostscript pswrite/ps2write devices don't support handling PDF forms as PostScript forms, so embed the olutput multiple times. My assumption is that this is why your approach [2] doesn't work.

他のヒント

At the beginning of your file, do

/drawBackground {
    save
    /showpage {} bind def
    <contents of background.eps>
    restore
} def

(The save, /showpage ... def, and restore lines are only necessary if your EPS has a showpage in it, which they often do.)

When you draw a page, do

drawBackground
...
showpage
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top