Graphics, Figures & Tables ⇒ manual positioning of several pdfs on one page
manual positioning of several pdfs on one page
I have several pdf files (call them input files) which I would like to put on a single page, with appropriate scaling and positions.
pdfpages should be the solution, though I couldn't manage to make it do what I need.
Here are the steps I would like to perform:
1. Each input file has some text, surrounded by white space. I need to crop the pdf tightly to the area where the contents are in it.
2. For each input file, I know the scaling and position on the page I would like it to appear.
3. I need to combine all the input files to the *same* page a single output pdf.
As an alternative to #1, I can assume that I have the source .tex of each input file. Is there any way to instruct pdflatex (preferrably within the .tex source) that the output should be cropped to the tight boundaries of the contents ? I would prefer a solution that does not involve treating the sources of the input files, if possible.
Any idea how to perform this task ?
thanks.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: manual positioning of several pdfs on one page
1. I know about the nup flag of pdfpages, but I don't want to use it since then scaling and position become dependent on the number of input files I have.
I would like to have a kind of solution
\includepdf[scale=0.4,crop=tight, position=15mm 30mm]{input1.pdf}
\includepdf[scale=0.6,crop=tight, position=55mm 20mm]{input2.pdf}
and so on...
2. I am actually using latex as a script for combining a set of input pdfs to one output pdf. Unfortunately, after spending hours on googling this, and in many other forums, I could only find merging to different pages, certainly not with control on scaling and positioning. This is why I am trying to solve this with Latex, but if you know a better way.. then please tell me.
thanks.
Re: manual positioning of several pdfs on one page
For each 'input' file:
1) Use latex to create dvi a file.
2) Run "dvips -E file.dvi" on each file create a ps file with a tight bounding box.
3) Run ps2pdf on the ps file that is output.
After that you will have a pdf with a tight margin around the text, allowing you to include it in the main document.
P.S. I say assuming a unix system because I don't know if the final two commands exist on windows
Re: manual positioning of several pdfs on one page
but how can I combine them into one file in the positions and scales I need ?
thanks.
Re: manual positioning of several pdfs on one page
I read the manual but it appears to import a single graphics and then to add annotations on it.
What I would like is to import the first input pdf and then import the other pdf and place them in known positions with repsect to the first file.
any idea of how to use xy for that task ?
maybe there are other packages to put graphics (which in my case are pdf files) in exact positions ?
thanks.
Re: manual positioning of several pdfs on one page
In this way you can control their position and size relative to the first input pdf.
Re: manual positioning of several pdfs on one page
Moreover, I would like to overlay figures, so that one figure is place in front of the other on the same locations. This cannot be done with subfig.
I think that xy gives this capability.
I managed to do the following:
\documentclass[a4paper,12pt]{article}
\usepackage{graphics}
\usepackage{xy}
\begin{document}
\begin{xy}
0*{\includegraphics{file1.pdf}}
+/r1cm/*{\includegraphics{file2.pdf}}
\end{xy}
\end{document}
This puts file2.pdf 1cm to the right of file1.
I still need to understand how it decides on the location of the origin, but this should not be a major problem.
manual positioning of several pdfs on one page
the textpos package lets you easily place objects (in particular, figures) at absolute positions on the page.
Re: manual positioning of several pdfs on one page
This indeed solves my main problem how to position the pdfs relatively to each other.
Now, I would like to return to the more simple task of cropping pdf to its tightest boundary box.
I would like to use something like \includegraphics[tight]{a.pdf} so that it will crop all margins to the tightest possible bounding box around the contents.
Any idea how to do that ?
Note, I don't want to calculate the bounding box by myself.. I would prefer this to be automatically....
thanks.
Re: manual positioning of several pdfs on one page
At present I use latex on .tex file to create .dvi, then dvipng -T tight produces .png file that contains only the contents of the .tex without any white spaces.
Can we do the same with pdf ?
I have the .tex files of the .pdf files, but if I compile them with pdflatex (or even dvi2pdf after latex) then the pdf have many white spaces around the text... I want to remove those margins.
thanks.