If I create a PDF with a 16:9 aspect ratio (e.g. for viewing via video projector) with a black background, I get a phantom white line at its bottom edge when I convert it to an image.
Here is minimal code to see this:
\documentclass{article}
\usepackage[papersize={160mm,90mm}]{geometry}
\usepackage{color}
\pagecolor{black}
\begin{document}
\null
\end{document}
Compile this via pdflatex or XeTeX, then:
pdftoppm test.pdf img
The result is a black image white a one pixel white line at the bottom.
I can get rid of this line by setting a slightly different papersize
, e.g.:
\usepackage[papersize={159.8mm,89.85mm}]{geometry}
I also can get rid of this if I use a 4:3 aspect ratio, e.g.:
\usepackage[screen]{geometry}
Is there a way to get rid of this line besides fudging papersize
, asking pdftoppm
to crop the page, or cropping afterward in Imagemagick? E.g. via making a black background rectangle on each page which is slightly larger than the paper size? And is the underlying problem a TeX rounding error or something to do with PDF output? Is there a way to directly set the background of a PDF document to black, not white, rather than working via pagecolor
?
The goal here is to generate 1920x1080 viewable images from TeX via, say:
pdftoppm -scale-to-x 1920 -scale-to-y -1 -png test.pdf img
I'd also be happy to learn a better way to produce screen output for pages with dark backgrounds. I got into this because when I view 16:9 PDFs generated this way in Preview via Slideshow mode, I see a distracting white border around dark pages. (I don't see this in Acrobat.) In trying to work around that by creating an image for each page, I ran to the pdftoppm
problem.
The only related question I can find: Beamer frames show a white line on top
pdftoppm
(essentially post-processing a PDF for a particular viewing environment). There may be two issues -- quirky viewing software, but also the line I see inpdftoppm
is undeniably there in the resulting ppm!identify -verbose test.pdf|grep -i color
showsBackground color: white
. This suggests to me that TeX is generating a white page then drawing black over it, maybe not all the way to the edges? But then I also seeBorder color: srgba(223,223,223,1)
, which is confusing. It could be the abstraction of PDF as page breaks down when used as a black background for the screen.