From 49bca338f550a6c48f7385c7bd208b5cafb7cf10 Mon Sep 17 00:00:00 2001 From: linnan Date: Wed, 12 Sep 2018 11:25:03 +0800 Subject: [PATCH] Fix #175 --- PdfiumViewer/PdfPrintDocument.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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)