Table of Contents

Class PdfBitmap

Namespace
Syncfusion.Pdf.Graphics
Assembly
Syncfusion.Pdf.Portable.dll

Represents the bitmap images.

public class PdfBitmap : PdfImage, IDisposable
Inheritance
PdfBitmap
Implements
Inherited Members

Constructors

PdfBitmap(Stream)

Creates new PdfBitmap instance.

public PdfBitmap(Stream stream)

Parameters

stream Stream

The stream.

PdfBitmap(Stream, bool)

Initializes a new instance of the PdfBitmap class from the specified file.

public PdfBitmap(Stream stream, bool enableMetadata)

Parameters

stream Stream

The data stream used to load the image.

enableMetadata bool

Enable metadata extraction from image

Examples

 //Create a new PDF document.
  PdfDocument doc = new PdfDocument();
  //Add a page to the document.
  PdfPage page = doc.Pages.Add();
  //Create PDF graphics for the page
  PdfGraphics graphics = page.Graphics;
  //Load the image from the disk with enable metadata extraction.
  PdfBitmap image = new PdfBitmap(File.OpenRead("Autumn Leaves.jpg"), true);
  //Get image metadata
  XmpMetadata metadata = image.Metadata;
  //Draw the image
  graphics.DrawImage(image, 0, 0);
  //Save the document.
  MemoryStream ms = new MemoryStream();
  doc.Save(ms);
  //Close the document.
 doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Load the image from the disk with enable metadata extraction.
Dim image As New PdfBitmap(File.OpenRead("Autumn Leaves.jpg"), true)
'Get image metadata
 Dim metadata As XmpMetadata = image.Metadata
'Draw the image
graphics.DrawImage(image, 0, 0)
'Save the document.
Dim ms As New MemoryStream()
doc.Save(ms)
'Close the document.
doc.Close(True)

Remarks

The file name and path can be relative to the application or an absolute path.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~PdfBitmap()

Releases unmanaged resources and performs other cleanup operations before the PdfBitmap is reclaimed by garbage collection.

protected ~PdfBitmap()