使用一堆外部图像创建一本没有文字/边距的图画书

使用一堆外部图像创建一本没有文字/边距的图画书

我有一个包含 jpg 文件的文件夹,想创建一个 PDF,其中每页都以“全屏”显示一张图片,因此没有边距或边框。只有图片,没有其他内容。

是否有一个简单的 LaTeX 代码来存档它?

答案1

您可以使用以下模板创建每页包含相同大小图像的文档:

\documentclass{article}

\usepackage{geometry}% For page geometry/layout specification
\usepackage{etoolbox}% For list processing/management
\usepackage{eso-pic}% For exact placement of content in the foreground/background
\usepackage{graphicx}% For inclusion of external images

% Change page geometry to match image size
\geometry{
  papersize = {3042px, 4032px},% width x height
  margin = 1in % Not really needed
}

\pagestyle{empty}% Remove any header/footer

\begin{document}

% How each image should be handled
\renewcommand{\do}[1]{%
  \clearpage% Move to next page
  \mbox{}% Set something invisible on the page
  \AddToShipoutPictureFG*{% Add image to this current pages's ForeGround
    \AtPageLowerLeft{% Position at lower left of page
      \includegraphics[width=\paperwidth,height=\paperheight]{#1}% Make image fit the page
    }%
  }%
}

% Process image list
\docsvlist{%
  example-image-a,
  example-image-b,
  example-image-c%
  % ...more images
}


\end{document}

相关内容