diff --git a/PdfiumViewer/PdfPrintDocument.cs b/PdfiumViewer/PdfPrintDocument.cs index 9e3bcd2..82edc3a 100644 --- a/PdfiumViewer/PdfPrintDocument.cs +++ b/PdfiumViewer/PdfPrintDocument.cs @@ -187,19 +187,13 @@ private void RenderPage(PrintPageEventArgs e, int page, double left, double top, left += (width - scaledWidth) / 2; top += (height - scaledHeight) / 2; - _document.Render( - page, - e.Graphics, + Image image = _document.Render(0, + AdjustDpi(e.Graphics.DpiX, e.PageBounds.Width), + AdjustDpi(e.Graphics.DpiX, e.PageBounds.Height), e.Graphics.DpiX, e.Graphics.DpiY, - new Rectangle( - AdjustDpi(e.Graphics.DpiX, left), - AdjustDpi(e.Graphics.DpiY, top), - AdjustDpi(e.Graphics.DpiX, scaledWidth), - AdjustDpi(e.Graphics.DpiY, scaledHeight) - ), - PdfRenderFlags.ForPrinting | PdfRenderFlags.Annotations - ); + PdfRotation.Rotate0, PdfRenderFlags.Annotations); + e.Graphics.DrawImageUnscaled(image, e.PageBounds.Location); } private static void Swap(ref double a, ref double b)