如何插入整页信纸大小的图像?

发布于 2024-09-01 03:49:22 字数 838 浏览 5 评论 0原文

我一直在尝试插入信纸大小的图像,但是由于文档样式(书籍)的边距定义,该图像被剪切,或其大小仅限于指定的边距。

下面是我成功获取图像大小的代码:

...
\newenvironment{pagportada}{
\begin{list}{}{
\setlength{\hoffset}{-1in}
\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{0cm}
\setlength{\leftmargin}{-1in}
\setlength{\rightmargin}{-1in}
\setlength{\textwidth}{14.3cm}
\setlength{\voffset}{-1in}
\setlength{\topmargin}{0.5cm}
\setlength{\headheight}{0pt}
\setlength{\topsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\footskip}{0pt}
\setlength{\textheight}{19.2cm}
%\setlength{\listparindent}{\parindent}
%\setlength{\itemindent}{\parindent}
%\setlength{\parsep}{\parskip}
}\item[]}
{\end{list}}

...然后调用环境来插入图形:

\begin{pagportada}
\includegraphics[width=\textwidth]{Portada}
\end{pagportada}
\newpage

I have been trying to insert a letter-size image, but either this is cut because of the margins definition of the document style (book), or its size is limited to the specified margins.

Below is the code with which I have managed to obtain the size of the image:

...
\newenvironment{pagportada}{
\begin{list}{}{
\setlength{\hoffset}{-1in}
\setlength{\oddsidemargin}{0cm}
\setlength{\evensidemargin}{0cm}
\setlength{\leftmargin}{-1in}
\setlength{\rightmargin}{-1in}
\setlength{\textwidth}{14.3cm}
\setlength{\voffset}{-1in}
\setlength{\topmargin}{0.5cm}
\setlength{\headheight}{0pt}
\setlength{\topsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\footskip}{0pt}
\setlength{\textheight}{19.2cm}
%\setlength{\listparindent}{\parindent}
%\setlength{\itemindent}{\parindent}
%\setlength{\parsep}{\parskip}
}\item[]}
{\end{list}}

... and then call the environment to insert the figure as:

\begin{pagportada}
\includegraphics[width=\textwidth]{Portada}
\end{pagportada}
\newpage

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆沫 2024-09-08 03:49:22

如果您使用 LaTeX:

\usepackage{eso-pic}

eso-pic 包将帮助您将对象放置在页面背景上。这不会尊重利润:这是你的需要。

要放置图像,请在页面上包含以下代码:

% First page
...

\newpage
% Second page
\AddToShipoutPicture{
    \put(0,0){
        \parbox[b][\paperheight]{\paperwidth}{
            \vfill
            \centering
            \includegraphics[width=\paperwidth,height=\paperheight,
             keepaspectratio]{Portada}
            \vfill
         }
    }
}
\newpage

将图像放置在 (0,0) 页面坐标处,并拉伸(保持纵横比)到整个页面,中间居中。

(未测试)

If you are using LaTeX:

\usepackage{eso-pic}

The eso-pic package will help you put objects on the background of pages. This will not respect margins: which is your need.

To put an image, include the following code on your page:

% First page
...

\newpage
% Second page
\AddToShipoutPicture{
    \put(0,0){
        \parbox[b][\paperheight]{\paperwidth}{
            \vfill
            \centering
            \includegraphics[width=\paperwidth,height=\paperheight,
             keepaspectratio]{Portada}
            \vfill
         }
    }
}
\newpage

And the image is put at (0,0) page-coordinates and stretched (maintaining aspect ratio) onto the whole page, middle centred.

(not tested)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文