How to set size of pdf page in pixels and put a background image

pdftex (and most likely also luatex, also I haven't checked) provides a primitive \pdfpxdimen and the unit px. See the pdftex manual, section 7.9. An example from the manual:

\pdfpxdimen=1in % 1 dpi
\divide\pdfpxdimen by 96 % 96 dpi
\hsize=1200px

px should work with the geometry package.


I downloaded the PNG of your self answer and did

file QXom4.png

getting the answer

QXom4.png: PNG image data, 600 x 399, 8-bit colormap, non-interlaced

Then I created the following file:

\documentclass{article}
\usepackage[margin=0pt,paperheight=399bp,paperwidth=600bp]{geometry}
\usepackage{graphicx}
\parindent=0pt
\pagestyle{empty}
\begin{document}
\includegraphics{QXom4.png}
\end{document}

This produced a PDF file with no margin whatsoever.

However, the simpler

\documentclass{standalone}
\usepackage{graphicx}
\begin{document}
\includegraphics{QXom4.png}
\end{document}

did the same, because standalone automatically clips the PDF to the dimension of its contents.

The default value of 1px is equal to 1bp. Well, 1px is 65782 scaled points, while 1bp is 65781 scaled points (1pt = 65536 scaled points, the difference is negligible). It's not recommended to use it (if you don't set it in your document with \pdfpxdimen), because it can be changed at format creation.


I did it:

\documentclass{standalone}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{color}
\usepackage{tikz}
\definecolor{green}{RGB}{0,101,0}
\color{green}
\begin{document}
\fontsize{12mm}{11mm}\selectfont
\begin{tikzpicture}
    \draw node[inner sep=0] {\includegraphics{bg.png}};
    \draw (1, 1) node[align=center] {mr. Dummy\\
      Group Name};
    \node at (7.4cm, -3.09cm) {10.01.2013};
\end{tikzpicture}
\end{document}

Gives this:

enter image description here