Bug introduced in 11.2 or earlier and persisting through 13.0.0 [CASE:4895073]
The following code produces a 10x10 grid of numbers, each in a 20x6 mm cell.
mm = 72/25.4;
{bx, by} = {20 mm, 6 mm};
label[num_] := Graphics[
Text[IntegerString[num, 10, 5], {10 mm, 3 mm}],
ImageSize -> {bx, by}, PlotRange -> {{0, bx}, {0, by}},
PlotRangePadding -> None]
labels = label /@ Range[100];
GraphicsGrid[Partition[labels, 10], Spacings -> 0]
Export["number.pdf", %]
When exporting to PDF, irrespective of the number of cells (even for a single cell without GraphicsGrid
), the PDF dimensions are not exact.
The exact dimensions should be 10x20 mm wide and 10x6 mm long, i.e. 200 x 60 mm.
However, the actual output has dimensions of 204.3 x 64.6 mm.
How to resolve this ? Mathematica version is 11.2 running on Win 10 x64.
Of course, I could just add an approximate factor of ~0.979 in the mm
definition, but that way it won't be really exact and will look ugly when merged with other graphics (in another program).
SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]
. $\endgroup$