Skip to content

Instantly share code, notes, and snippets.

@anddam
Last active March 23, 2017 20:55
Show Gist options
  • Save anddam/6c6903b15c208f6d5d20e3b7933561c1 to your computer and use it in GitHub Desktop.
Save anddam/6c6903b15c208f6d5d20e3b7933561c1 to your computer and use it in GitHub Desktop.
\documentclass{extreport}
\usepackage{pdfpages}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\begin{document}
%PDF sample page URL http://www.inkwelleditorial.com/pdfSample.pdf
\includepdf{pdfSample.pdf}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment