Get the PixMap image as a System.Drawing.Bitmap.




System.Drawing.Bitmap GetBitmap()

[Visual Basic]
Function GetBitmap() As System.Drawing.Bitmap

Throws Exceptions may throw Exception()



Name Description
return The Bitmap containing the image.




Use this method to get the PixMap image as a System.Drawing.Bitmap.

You can then use this Bitmap for drawing to screen or for manipulation using System.Drawing routines.

ABCpdf tries to make a literal copy of the image contained in the PixMap, both to minimize color shifts and also for speed.

However because PDF images can contain many color spaces and bit depths that are unsupported by System.Drawing it may be necessary to change the color space or bit depth of the image.

In addition there are certain parameters such as decode arrays which may be used to modify the image before display. This method returns the image content as literally as possible which means decode arrays and alpha channels are not included.

Please note that some formats of Bitmaps are not usable for certain operations. In particular, indexed color bitmaps cannot be drawn on using the Graphics.FromImage method. For this reason if you are going to wish to draw on the returned Bitmap you should check the pixel format before use.




This example shows how to extract all the page thumbnails (if they exist) from a document. See also the PDFSurgeon example project for another example.


using (Doc doc = new Doc(), srcDoc = new Doc()) {   doc.Read(Server.MapPath("embedthumbnails.pdf"));   doc.Rendering.DotsPerInch = 18;   Page[] pages = doc.ObjectSoup.Catalog.Pages.GetPageArrayAll();   foreach (Page page in pages) {     if (page.Thumbnail == null)       continue;     using (Bitmap bm = page.Thumbnail.GetBitmap())       bm.Save($"embedthumbnails{page.Thumbnail.ID}.jpg");   } }

embedthumbnails.pdf - [Page 1]

embedthumbnails.pdf - [Page 2]

embedthumbnails.pdf - [Page 3]

embedthumbnails.pdf - [Page 4]