Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8580441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:49:52+00:00 2026-06-11T20:49:52+00:00

I convert PDF -> many JPEG and many JPEG -> many PDF using ghostscript

  • 0

I convert PDF -> many JPEG and many JPEG -> many PDF using ghostscript. I need to add watermark text on every converted JPEG (PDF) page. Is it possible using only Ghostscript and PostScript?

The only way I found:

gswin32c -q -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=output.pdf watermark.ps input.pdf

But this will insert watermark.ps watermark on first separate page in output.pdf.

Can I do this on output PDF pages directly?

Can I do this on output JPEG pages directly?

<<
   /BeginPage
   { gsave
       /Helvetica_Bold 120 selectfont
       .85 setgray 130 70 moveto 50 rotate (Sample) show
     grestore
   } bind
>> setpagedevice

If I use /EndPage instead of /BeginPage – it says setpagedevice is not applicable…

How to remake this script for /EndPage?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:49:53+00:00Added an answer on June 11, 2026 at 8:49 pm

    Bit too big for a comment, so I’ve added a new answer. The EndPage procedure (see page 441 of the PostScript Language Reference Manual) takes two additional parameters on the stack, a count of pages emitted so far, and a reason code.

    You can use the count of pages to do interesting things like duplexing, or only marking even pages or whatever, but I assume in this case you don’t want it, so you just ‘pop’ it from the stack.

    The reason code tells you why the page is being emitted, again you probably don’t care so you just pop the value.

    Finally the EndPage must return a boolean value to the interpreter saying whether or not to transmit the page (this allows you to do other interesting things, like only printing the first 10 pages and so on).

    So you need to initially remove two values, execute your code and return a boolean. Pretty trivial:

    <<
       /EndPage
       { pop pop %% *BEFORE* gsave as that puts a gsave object on the stack
         gsave
         /Helvetica_Bold 120 selectfont
         .85 setgray 130 70 moveto 50 rotate (Sample) show
         grestore
         true %% transmit the page, set to false to not transmit the page
       } bind
    >> setpagedevice
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to convert a PDF into a single image using GhostScript. Only the
i was using ghostscript to convert PDF's to Tif with C$ class wrapper and
I m using Dompdf to convert Html Page to PDF. As client's requirement pdf
I am using xpdf to convert pdf files to text. Below is the code
Is there a way to convert PDF to SWF using PHP. Basically I need
In my application, I need to convert PDF docs to PCL5 generic files to
I have a bunch of PDF files that I need to convert to TXT.
I need to convert PDF pages to TIF files from within my app (or
need to convert a pdf file to a doc file. I found different type
Need to convert pdf file to image file (jpg, png, gif) to show on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.