# Printing several A4 pages in PDF

I want to create a pdf file with several pages. Each page should contain only an image without any margins. It works fine when I'm exporting just one image as pdf, but some weird margins appear when I'm trying to print several pages.

So here is an example (both images have a proper A4 size for 150 dpi):

img1 = ImageResize[ExampleData[{"TestImage", "Aerial"}], {1240, 1754}];
img2 = ImageResize[ExampleData[{"TestImage", "Aerial2"}], {1240, 1754}];


Exporting of one image works fine:

Export["test1.pdf", img1]


But I fail to print several pages without any margins:

nb=CreateDocument[
{img1,img2},
Visible->False,
PageBreakBelow->True,
PrintingOptions->{
"PageSize"->{1240,1754},
"PaperSize"->{1240,1754},
"RestPagesFooter"->False,
"PrintingMargins"->{{0, 0}, {0, 0}}
}
];
Export["test2.pdf",nb]


So how could I create a pdf looking like "test1.pdf" but with several pages?

• PageSize and PaperSize are measured in printer's points (1/72 inches). Change to "PaperSize" -> {595, 842} for A4 paper. The margins will also be reduced, if you keep "PageSize"->{1240, 1754} . – LouisB Apr 10 at 0:11
• "PaperSize" doesn't really matter, the problem is in the difference between exporting one page and exporting several pages. Changing "PaperSize" doesn't help to get rid of weird margins which don't appear during one page exporting. – Dmitriy Apr 10 at 9:28

I've found a possible solution which is weird yet useful.

toCell[img_] := Cell[
BoxData[ToBoxes@img],
CellMargins -> {{0, 0}, {0, 0}},
"Magnification" -> 1]

nb = CreateDocument[
toCell /@ {img1, img2},
Visible -> False,
PageBreakBelow -> True,
PrintingOptions -> {
"PageSize" -> {1240, 1754},
"PaperSize" -> {1240, 1754},

• changing right margin of "PrintingMargins" into negative (exact value depends on page and/or paper size).