1

I have two one-page PDF files (https://brightlight.today/fileserver/downloads/6fee1900940e73acde6311b80161c53b and https://brightlight.today/fileserver/downloads/81c9cb755c53720a12f00f31ce5e3ec8):

enter image description here and enter image description here

I would like to combine them to one PDF document 2-up (combine both pages to one output page) but make them take up the whole pdf document. When I run pdfjam lyrics-text.pdf mightyfortress-cropped.pdf --landscape --nup 2x1 --outfile lyrics-two-up.pdf;, I get

enter image description here

I can see that the sheet music could be a good deal larger and still fit on the page. When I run pdfjam lyrics-text.pdf mightyfortress-cropped.pdf --scale 1.1 --landscape --nup 2x1 --outfile lyrics-two-up.pdf;, I get

enter image description here

which is not good. Further efforts at scaling up or down one page or the other results in further frustration. I even tried using the pdfpages package latex package in a latex document, and got the same results (\includepdfmerge[landscape=true,nup={1x2},scale=1.1]{lyrics-text.pdf,mightyfortress-cropped.pdf}).

I also tried pdftk lyrics-text.pdf mightyfortress-cropped.pdf cat output lyrics-two-up.pdf; then open in evince and print two pages to one page:

enter image description here

Seems like a pleasing output, but I would like it to be much bigger to take up more of the page. Changing the "scale" option in the printing options doesn't seem to help anything.

I've hit variations of this problem over and over in the past decade or so. In general, I would like to be able to put any page from any source PDF anywhere and any size on any page of the output PDF. Is that too much to ask? ;-)

2 Answers 2

2

The approach below inserts the two images on a blank page and scales (or resizes) each individually. The image placements are done at page shipout and moved into position.

enter image description here

\documentclass{article}

\usepackage[landscape]{geometry}
\usepackage{graphicx,eso-pic}

\pagestyle{empty}

\begin{document}

\mbox{}% Place some blank content on the page

% Insert lyrics of hymn on left of page
\AddToShipoutPictureFG{%
  \AtPageLowerLeft{%
    \hspace*{1em}% Indent from left margin
    \raisebox{\dimexpr.5\paperheight-.5\height}{% Raise to middle of page vertically
      \includegraphics[scale=.7]{lyrics-text}% Insert lyrics
    }%
  }%
  \AtPageLowerLeft{%
    \makebox[\paperwidth][r]{%
      \raisebox{\dimexpr.5\paperheight-.5\height}{% Raise to middle of page vertically
        \includegraphics[scale=.8]{mightyfortress-cropped}% Insert sheet music
      }%
      \hspace*{1em}% Indent from right margin
    }%
  }%
}

\end{document}
4
  • This looks like a very excellent answer. It's a bit opaque to me, do you mind explaining it? Just inside AddToShipoutPictureFG; I understand everything before that I think. Commented Sep 26, 2021 at 0:57
  • 1
    @lmat-ReinstateMonica: Consider the page to be shipped out as a picture. It's contents includes the usual text and page number positioned just so. \AddToShipoutPictureFG adds content to the ForeGround just before the page is shipped out. Positioning macros like \AtPageLowerLeft provides a location-based placement option. For the left image, we insert a space then raise the lyrics to the vertical centre of the page (the anchor point of the image would otherwise be at the bottom)...
    – Werner
    Commented Sep 26, 2021 at 10:41
  • 1
    @lmat-ReinstateMonica: ... Since there is no \AtPageLowerRight location-based placement option, I use \AtPageLowerLeft but insert a box that is the width of the page and right-aligned (via \makebox[\paperwidth][r]). This time also I raise the image into position vertically and then insert a space (of 1em, that you can change). I'd suggest moving around some of the code and/or changing some of the values and seeing how it affects the output. You can read the eso-pic documentation.
    – Werner
    Commented Sep 26, 2021 at 10:45
  • You are the master. Commented Sep 26, 2021 at 18:09
1

This is how it can be done with pdfpages:

\documentclass[letterpaper,landscape]{article}
\usepackage{pdfpages}

\begin{document}
\includepdfmerge[
  templatesize={450bp}{630bp},
  nup=2x1,
  delta=-20bp 0bp,
  offset=20bp 0bp,
  % frame=true
]{lyrics-text.pdf, mightyfortress-cropped.pdf}
\end{document}

With pdfjam it is:

pdfjam --templatesize {450bp}{630bp} --landscape --nup 2x1 --delta '-20 0' --offset '20 0' lyrics-text.pdf mightyfortress-cropped.pdf

Note, that the parameters for \includepdf are tailored exactly to your particular pdfs. It's a bit trail and error to find the correct parameters and I don't think there's a real benefit in using pdfpages here. Werner's answer might be easier to understand.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .