diff --git a/PdfiumViewer/PdfDocument.cs b/PdfiumViewer/PdfDocument.cs index 9541b49a..a57645f5 100644 --- a/PdfiumViewer/PdfDocument.cs +++ b/PdfiumViewer/PdfDocument.cs @@ -161,11 +161,6 @@ private PdfDocument(Stream stream, string password) PageSizes = new ReadOnlyCollection(_pageSizes); } - /// - /// Renders a page of the PDF document to the provided graphics instance. - /// - /// Number of the page to render. - /// Graphics instance to render the page on. /// Horizontal DPI. /// Vertical DPI. /// Bounds to render the page in. @@ -289,7 +284,7 @@ public Image Render(int page, int width, int height, float dpiX, float dpiY, boo /// The rendered image. public Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRenderFlags flags) { - return Render(page, width, height, dpiX, dpiY, 0, flags); + return Render(page, width, height, dpiX, dpiY, 0, flags & ~PdfRenderFlags.Annotations, (flags & PdfRenderFlags.Annotations) != 0); } /// @@ -304,6 +299,23 @@ public Image Render(int page, int width, int height, float dpiX, float dpiY, Pdf /// Flags used to influence the rendering. /// The rendered image. public Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRotation rotate, PdfRenderFlags flags) + { + return Render(page, width, height, dpiX, dpiY, rotate, flags, false); + } + + /// + /// Renders a page of the PDF document to an image. + /// + /// Number of the page to render. + /// Width of the rendered image. + /// Height of the rendered image. + /// Horizontal DPI. + /// Vertical DPI. + /// Rotation. + /// Flags used to influence the rendering. + /// Draw form fields. + /// The rendered image. + public Image Render(int page, int width, int height, float dpiX, float dpiY, PdfRotation rotate, PdfRenderFlags flags, bool drawFormFields) { if (_disposed) throw new ObjectDisposedException(GetType().Name); @@ -336,7 +348,7 @@ public Image Render(int page, int width, int height, float dpiX, float dpiY, Pdf 0, 0, width, height, (int)rotate, FlagsToFPDFFlags(flags), - (flags & PdfRenderFlags.Annotations) != 0 + drawFormFields ); if (!success) diff --git a/PdfiumViewer/PdfFile.cs b/PdfiumViewer/PdfFile.cs index 298e8198..74cb012b 100644 --- a/PdfiumViewer/PdfFile.cs +++ b/PdfiumViewer/PdfFile.cs @@ -60,9 +60,6 @@ public bool RenderPDFPageToBitmap(int pageNumber, IntPtr bitmapHandle, int dpiX, using (var pageData = new PageData(_document, _form, pageNumber)) { - if (renderFormFill) - flags &= ~NativeMethods.FPDF.ANNOT; - NativeMethods.FPDF_RenderPageBitmap(bitmapHandle, pageData.Page, boundsOriginX, boundsOriginY, boundsWidth, boundsHeight, rotate, flags); if (renderFormFill)