It's a bug in
MigraDocPrintDocument.
Add this to class
MigraDocPrintDocument:
Code:
[DllImport("gdi32.dll")]
static extern int GetDeviceCaps(IntPtr hdc, int capability);
const int PHYSICALOFFSETX = 112; // Physical Printable Area x margin
const int PHYSICALOFFSETY = 113; // Physical Printable Area y margin
And this into function
OnPrintPageCode:
Graphics graphics = e.Graphics;
IntPtr hdc = graphics.GetHdc();
int xOffset = GetDeviceCaps(hdc, PHYSICALOFFSETX);
int yOffset = GetDeviceCaps(hdc, PHYSICALOFFSETY);
graphics.ReleaseHdc();
graphics.TranslateTransform(-xOffset * 100 / graphics.DpiX, -yOffset * 100 / graphics.DpiY);
Setting OriginAtMargins = true is the correct solution by documentation of GDI+, but it does not work.