# Imposing a pdf/postscript on top of another one

Polytropon freebsd at edvax.de
Mon Aug 21 10:20:17 UTC 2017

On Sun, 20 Aug 2017 18:53:47 -0500, Antonio Olivares wrote:
> On Sunday, August 20, 2017, Polytropon <freebsd at edvax.de
> <javascript:_e(%7B%7D,'cvml','freebsd at edvax.de');>> wrote:

Erm... I'm not Mister Javascript Underscore Percent Percent.
You are probably using a webmailer with a slight hickup.. ;-)

> The stackexchange page has pdftk as its first choice
>
> https://stackoverflow.com/questions/501723/overlay-one-
> pdf-or-ps-file-on-top-of-another
>
> However, my machine which has the postscript files is offline (no internet
> connection) and no pdftk is available to do this :(

Okay, so you have to stick with the installed tools. I can
fully relate to this very special kind of situation ("use
what you have, not what you don't have"). Of course, that
doesn't make things easier.

A solution that I would have in mind is to do the whole
work in LaTeX, but you said you don't want to do that.
You _could_, however, create the gnuplot output with a
white / transparent background and either use it in EPS
format, or use convert (from ImageMagic) to turn it into
a PNG file; then use \includegraphics{} with the package
inclusion \usepackage[pdftex]{graphicx} to include the
image into the file. With \usepackage[absolute]{textpos},
put it into a "textblock" environment (to position it at
the desired location of the page) _before_ you add the
actual content; e. g., \begin{textblock}{width}(pos,pos)
\includegraphics[width/height=,keepaspectratio]{backgr.png}
\end{textblock} - and _now_ your text.

With pdflatex, the output will be a PDF file, as desired.

> Thanks for your input.  I may have to copy the files and take them to
> another machine so I can try to use pdftk or maybe use a command from
> imagemagick which can do the job?

I think ImageMagick's ability to process PS or PDF is quite
limited, but you could - attention! stupid idea ahead! - turn
the PDF file's pages into images, the background GNUplot out-
put too, then overlay them with convert's -composite option,
and finally turn the result back into a PDF file; of course
now all text information will be lost, as there is only the
image of text, which might reduce the usability of the result.
But I said it's a stupid idea. :-)

--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...