Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to insert text on every pages of a PS document

New Here ,
Jun 16, 2008 Jun 16, 2008
Hi all,

I'm working on a lprng's filter on Redhat 5 enteprise.
With my filter I want to insert text (a system number) on the top of every page.
To do that I've tried the following solution that works for many cases:

gsave
/Times-Roman-Bold findfont
10 scalefont
setfont
newpath
150 820 moveto
("text I want to insert") show
grestore

I insert that code after each "%%Page:" lines or before each "showpage"
The problem is that it doesn't always work. It depends on the application that has generated the PS. Sometimes my text doesn't appear.
The other problem is for PS files that do not contains any "%%Page", and only 1 "showpage" (html2ps generates that kind of file), my text appears only on the first page.

My question is the following:
Is there a PostScript solution to insert text on the top of every page with only 1 command (not after each %%Page but only once at the beginning of the document for exemple) ?

Thank you very much in advance for any suggestion

Romain
TOPICS
Programming
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 16, 2008 Jun 16, 2008
You could use PostScript's
b BeginPage
feature to do this, e.g. by putting

<</BeginPage {pop ...insert your code here ... }>>setpagedevice

near the end of the setup section of your PS job. But be aware that even this apporach may fail, e.g. if the pages start with a white fill of the whole page area, which will overpaint the outcome of the BeginPage procedure.

Helge
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 16, 2008 Jun 16, 2008
LATEST
Hi Helge,

Thank you very much for your answer.
That is exactly what I was looking for.
As if this approach may fail in a few case, it is more reliable than my previous solution.

Romain
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines