
我只是想看清楚PDF。有沒有辦法使用 pdfpages 套件透過 PDF 覆蓋背景圖像(jpg 檔案)?或是有沒有辦法單獨使用PDF的不透明度?
\documentclass{book}
\usepackage{graphicx}
\usepackage[paperwidth=11.7in, paperheight=8.3in]{geometry}
\usepackage{background}
\usepackage{pdfpages}
\backgroundsetup{
position={5.4125in,-3.5in},
scale=.9,
angle=-.5,
opacity=0.2,
contents={\includegraphics{ImageName}}
}
\begin{document}
\includepdf[pages=-]{filename}
\end{document}
答案1
這應該對你有用。請在評論中添加更多疑問,以便我可以根據要求對其進行增強:
\documentclass{article}
\usepackage[paperwidth=11.7in, paperheight=8.3in]{geometry}
\usepackage[pages=some]{background}
\usepackage{pdfpages}
\backgroundsetup{
scale=0.9,
opacity=0.2,
angle=-.5,
position={5.4125in,-3.5in},
contents={%
\includegraphics[width=\paperwidth,height=\paperheight]{Small-mario.png}
}%
}
\begin{document}
\BgThispage
\includepdf[pages=-]{Test2}
\clearpage
\end{document}
答案2
由於該background
套件是基於 構建的tikz
,特別是基於命令pdfpages
構建的,因此您可以這樣做。graphicx
\includegraphics
在tikzpicture
環境中,使用環境將影像放在背景圖層上pgfonlayer
。 pdf 可以透過將其放置在主圖層上來覆蓋背景圖像,這不必在程式碼中明確編寫。您可以將背景影像的不透明度設為您想要的任何值,而不會影響頂部 pdf 的可見度。這是針對帶有opacity=0.9
、opacity=0.5
和的三個背景圖像進行說明的opacity=0.1
。
\documentclass[a4paper,10pt]{article}
\usepackage[showframe,margin=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{MWE} % for example-image-a.png and example-image-a4.pdf
\usepackage{tikzpagenodes} % for (current page text area.north)
\usetikzlibrary{backgrounds} % for {pgfonlayer}{background}
\pgfdeclarelayer{background} % add the background layer
\pgfsetlayers{background,main} % specify the order of the layers
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
% Put images in the background
\begin{pgfonlayer}{background}
\node[opacity=0.9,anchor=north] (A) at (current page text area.north) {\includegraphics[scale=0.5]{example-image-a}};
\node[opacity=0.5,below=3cm] (B) at (A.south) {\includegraphics[scale=0.5]{example-image-a}};
\node[opacity=0.1,below=3cm] (C) at (B.south) {\includegraphics[scale=0.5]{example-image-a}};
\end{pgfonlayer}
% Put an image in the main layer
\node at (current page text area.center) {\includegraphics{example-image-a4}};
\end{tikzpicture}
\end{document}