Class PdfBitmap
Represents the bitmap images.
Implements
System.IDisposable
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfBitmap : PdfImage, IPdfWrapper, IDisposable
Constructors
PdfBitmap(Stream)
Creates new PdfBitmap instance.
Declaration
public PdfBitmap(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream. |
PdfBitmap(Stream, Boolean)
Initializes a new instance of the PdfBitmap class from the specified file.
Declaration
public PdfBitmap(Stream stream, bool enableMetadata)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The data stream used to load the image. |
System.Boolean | enableMetadata | Enable metadata extraction from image |
Remarks
The file name and path can be relative to the application or an absolute path.
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)
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Finalize()
Releases unmanaged resources and performs other cleanup operations before the PdfBitmap is reclaimed by garbage collection.
Declaration
protected override void Finalize()
Implements
System.IDisposable