I use luatex and had some trouble with the accuracy of the calculation of the bp-lengths:
The measurement of the distances between the Media|BleedBox and the TrimBoxes reported e.g. 4.97mm instead of 5mm (Acrobat preflight reported another distance of 4.98mm).
After I used expl3's \dim_to_decimal_in_bp
the problems are gone: 5mm == 5mm. ;-)
The following code should demonstrate the [slightly] differences (at least regarding the width):
\RequirePackage{luatex85}
\pdfcompresslevel=0
\pdfobjcompresslevel=0
\documentclass[12pt]{article}
\usepackage[%
paperwidth=540mm,
paperheight=226mm,
margin=0cm,
noheadfoot,
]{geometry}
\makeatletter
\edef\pwpt{\strip@pt\dimexpr0.996264009963\paperwidth\relax}
\edef\phpt{\strip@pt\dimexpr0.996264009963\paperheight\relax}
\makeatother
%Alternative conversion using expl3:
\usepackage{xparse}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\convert}{m}{%
\fp_eval:n
{
round ( \dim_to_decimal_in_bp:n { #1 } , 3 )
}
}
\ExplSyntaxOff
\edef\mypdfpageattr{
/MediaBox[%
0
0
\pwpt\space
\phpt]^^J
/MediaBox[%
0
0
\convert{\paperwidth}\space
\convert{\paperheight}]^^J
}
\expandafter\pdfpageattr\expandafter{\mypdfpageattr}
\begin{document}
These dimensions (at least the width) do not match the auto-generated MediaBox
definition:
Paper width is \pwpt\ PS points ($\leftarrow$ differs from auto-generated
MediaBox definition)
Paper height is \phpt\ PS points ($\leftarrow$ seems ok)
\bigskip
The following results do match the automatically added MediaBox (open pdf
file in text editor for details):
Paper width is \convert{\paperwidth}\ PS points ($\leftarrow$ seems better)
Paper height is \convert{\paperheight}\ PS points ($\leftarrow$ seems better)
\end{document}
Note: The two MediaBox definitions add a second and a third /MediaBox[...
statement, to the resulting pdf file (open pdf in text editor, for details): Don't know the cause for the first and whether it can be replaced.