PDF Geometry – How to Scale an \includepdf onto a Page with a Different Geometry in LaTeX

geometrypagepdfpdfpagesscaling

UPDATED

Consider the code (which I compile with xelatex)

\documentclass[12pt,onecolumn,openany,final]{book}
\usepackage[hmargin=0in,vmargin=0in,paperwidth=5.625in,paperheight=8.5in]{geometry}
 
\usepackage{pstricks,psvectorian}


\usepackage{scalerel} % For Vertical Stretch of Letters
\usepackage{scalefnt}

\usepackage{color}

\definecolor{BrooklynGold}{RGB}{228,168,73}
\definecolor{LightBlue}{RGB}{80,136,192}

\definecolor{crimson}{cmyk}{0,1,1,0.4}


% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% 
%                     Use Xelatex to Compile
%
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %


% Overlay Titles

\newcommand{\mytitle}[1]% #1 = title
{\bgroup
  \Huge
  \sbox0{\parbox{\columnwidth}{\centering\textbf{\color{black}#1}}}%
  \sbox1{\parbox{\columnwidth}{\centering\textbf{\color{BrooklynGold}#1}}}%
  \usebox0\llap{\raisebox{1.45pt}{\usebox1}}
\egroup}


\newcommand{\mmmytitle}[1]% #1 = title
{\bgroup
  \LARGE
  \sbox0{\parbox{\columnwidth}{\centering\textbf{\color{black}#1}}}%
  \sbox1{\parbox{\columnwidth}{\centering\textbf{\color{LightBlue}#1}}}%
  \usebox0\llap{\raisebox{1.37pt}{\usebox1}}
\egroup}

\begin{document}
\thispagestyle{empty}

\noindent\begin{pspicture}(-7.135,0)(7.135,21.555)%

\renewcommand*{\psvectorianDefaultColor}{BrooklynGold}%
\psframe[fillcolor=crimson,fillstyle=solid](-7.135,0)(7.135,21.555)%
\psframe[linecolor=crimson](-7.135,0)(7.135,21.555)% draws frame.


% four corners
\rput[tl](-6.815,21.235){\psvectorian[width=4cm]{63}}
\rput[tr](6.815,21.235){\psvectorian[width=4cm,mirror]{63}}
\rput[bl](-6.815,0.32){\psvectorian[width=4cm,flip]{63}}
\rput[br](6.815,0.32){\psvectorian[width=4cm,flip,mirror]{63}}


\rput[tc](0,11.50){\mytitle{\vstretch{1.85}{\textbf{B o o k \, T i t l e}}}}

\rput[bc](0,9.25){\mmmytitle{\selectfont\scalefont{0.90}{\textbf{\textsl{T H E \, A U T H O R}}}}}
\end{pspicture}%
\end{document}

which produces the 5.625in x 8.5in image output

enter image description here

Now, I call in the above 5.625in x 8.5in PDF output into the following code (which I compile with pdflatex)

\documentclass[12pt,twoside,openany]{book}

\usepackage[showframe,paperwidth=5.5in,paperheight=8.25in]{geometry}
\usepackage{mathptmx} % replaces obsolete times package.
\usepackage{pdfpages}

\textwidth=4in \textheight=6.40in \voffset -7pt

\begin{document}
%\includepdf[pages={1},scale=0.99,offset=-1 -7]{Cover_page2.pdf}
\includepdf[width=1.02273\paperwidth,height=1.0303\paperheight]{Cover_page2.pdf}
\end{document}

and which produces the following page output with dimensions 5.5in x 8.25in:

enter image description here

Now, the ratios in width=1.02273\paperwidth,height=1.0303\paperheight I obtained by respectively calculating the ratios 5.625/5.5 and 8.5/8.25. Yet, as one can see from the second output, a portion of the top of the first image has been truncated. Though logically, it seems to me, that this approach should work.

QUESTION: Can anyone tell me what I may be doing wrong; and how I may properly scale the first image to fit nicely onto a 5.5in x 8.25in page?

Thank you.

Best Answer

I found that this code answer your request.

\documentclass[12pt,twoside,openany]{book}

\usepackage[showframe,paperwidth=5.5in,paperheight=8.25in]{geometry}
\usepackage{mathptmx} % replaces obsolete times package.
\usepackage{pdfpages}

\begin{document}
        \includepdf[scale=1,pages=1,frame]{cover.pdf}
\end{document}

Capture from sumatra pdf reader.

To check the correct inclusion of the frame I used
\psframe[linecolor=green](-7.135,0)(7.135,21.555) to make cover.pdf

instead of linecolor=crimson

c

Or using your scaling

\documentclass[12pt,twoside,openany]{book}

\usepackage[showframe,paperwidth=5.5in,paperheight=8.25in]{geometry}
\usepackage{mathptmx} % replaces obsolete times package.
\usepackage{pdfpages}

%\textwidth=4in \textheight=6.40in \voffset -7pt % supress this line <<<<<<<<<<<<<<<<<<

\begin{document}
    \includepdf[width=1.02273\paperwidth,height=1.0303\paperheight]{cover.pdf}
\end{document}
Related Question