如何将多个不同大小的 pdfpages 插入到一页中

如何将多个不同大小的 pdfpages 插入到一页中

我使用该包\pdfpages将多个 pdf 页面插入到 1 页中。问题是我想在页面顶部放置 4 个正方形,在底部放置 1 个矩形。高度和宽度与正方形相匹配,但我不知道如何将它们放入 1 页中?这是我使用的代码:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{pdfpages}

\begin{document}

\includepdf[pages=-,nup=2x3]{name_of_pdf.pdf}

\end{document}

我尝试使用该\includepdf功能两次,但它不在同一页面上。

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{pdfpages}

\begin{document}

\includepdf[pages=1-4,pagecommand={ \thispagestyle{empty}}, fitpaper=true, nup=2x2]{name_of_pdf.pdf}
\includepdf[pages=5,pagecommand={\thispagestyle{empty}}, fitpaper=true]{name_of_pdf.pdf}

\end{document}

答案1

这显示了如何在一页上排列多幅图像,以填满整个页面。

\documentclass{article}
\usepackage{graphicx}

\newlength{\toppagemargin}
\newlength{\leftpagemargin}

\begin{document}
\newpage% increment page counter
\thispagestyle{empty}%
\setlength{\toppagemargin}{\dimexpr 1in+\topmargin+\headheight+\headsep}%
\ifodd\value{page}
  \setlength{\leftpagemargin}{\dimexpr 1in+\oddsidemargin}%
\else
  \setlength{\leftpagemargin}{\dimexpr 1in+\evensidemargin}%
\fi
\noindent\begin{minipage}[c][\textheight][c]{\textwidth}% fill text area
  \vspace*{-\toppagemargin}%
  \hspace*{-\leftpagemargin}%
  \begin{minipage}[c][\paperheight][t]{\paperwidth}% fill whole page
    \lineskip=0pt
    \includegraphics[height=0.5\paperheight, width=0.5\paperwidth]{example-image}%
    \includegraphics[height=0.5\paperheight, width=0.5\paperwidth]{example-image-a}
    
    \includegraphics[height=0.5\paperheight, width=0.5\paperwidth]{example-image-b}%
    \includegraphics[height=0.5\paperheight, width=0.5\paperwidth]{example-image-c}
  \end{minipage}%
  \hspace{\dimexpr \leftpagemargin+\textwidth-\paperwidth}%
  \vspace{\dimexpr \toppagemargin+\textheight-\paperheight}
\end{minipage}

\end{document}

相关内容