Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #3829

Re: add a logo (png or pdf) to a PDF using only Ghostscript

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: add a logo (png or pdf) to a PDF using only Ghostscript
Date 2023-01-19 18:01 +0000
Message-ID <MPG.3e3395c1f874e8f69898d9@usenet.plus.net> (permalink)
References <tqbhev$1iols$1@dont-email.me>

Show all headers | View raw


In article <tqbhev$1iols$1@dont-email.me>, jszhao@yeah.net says...
> 
> Hi there,
> 
> Is it possible to add a logo (png or pdf) to a PDF using only Ghostscript?

Sort of, but it isn't trivial. For a PNG you would first havr to write a 
PostScript program to read PNG files, since Ghostscript doesn't read 
PNG.

> I have learned how to embed text as PDF annotation with Ghostscript, 
> however, I don't find a way to emb an image to a existing PDF page.
> 
> I would appreciate any help or hint.

You need to look at the 'scripting the PDF interpreter' section of the 
documentation. You will need to set up the PDF interpreter, set the 
media size, draw the page contents, then draw the additioanl content, 
then 'show' the page. Depending on the input you may need to open two 
PDF files simultaneously to do this.

Note that Ghostscript and the pdfwrite device do not 'add' to existing 
files, or modoify files. The outpuit file is completely new and may b 
ear no realtyion (in its internal structure) to the original file.


			Ken

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

add a logo (png or pdf) to a PDF using only Ghostscript Jinsong Zhao <jszhao@yeah.net> - 2023-01-19 21:43 +0800
  Re: add a logo (png or pdf) to a PDF using only Ghostscript ken <ken@spamcop.net> - 2023-01-19 18:01 +0000
  Re: add a logo (png or pdf) to a PDF using only Ghostscript David Newall <ghostscript@davidnewall.com> - 2023-02-04 14:15 +1100

csiph-web