PDF Manipulation – How to Combine PDF Documents Scaling One Page

pdfpdfpages

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? 😉

Best Answer

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}