Class PdfImageInfo
Represents the utility class to store information about Images and its location.
Inheritance
System.Object
PdfImageInfo
Implements
System.IDisposable
Namespace: Syncfusion.Pdf.Exporting
Assembly: Syncfusion.Pdf.Imaging.NET.dll
Syntax
public class PdfImageInfo : Object, IDisposable
Examples
//Load PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets ImageInfo from the first page.
PdfImageInfo[] imageInfo = document.Pages[0].ExtractImages();
//Gets the Image Boundary location.
RectangleF imageBounds = imageInfo[0].Bounds;
//Gets the Image.
Image image = imageInfo[0].Image;
//Gets the Image index.
int imageIndex = imageInfo[0].Index;
//Closing the PDF document.
document.Close(true);
'Load PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
'Gets ImageInfo from the first page.
Dim imageInfo As PdfImageInfo() = document.Pages(0).ExtractImages()
'Gets the Image Boundary location.
Dim imageBounds As RectangleF = imageInfo(0).Bounds
'Gets the Image.
Dim image As Image = imageInfo(0).Image
'Gets the Image index.
Dim imageIndex As Integer = imageInfo(0).Index
'Closing the PDF document.
document.Close(True)
Properties
Bounds
Gets the image boundary location.
Declaration
public RectangleF Bounds { get; }
Property Value
Type |
---|
RectangleF |
ImageFilter
Gets the image filter.
Declaration
public string[] ImageFilter { get; }
Property Value
Type |
---|
System.String[] |
Examples
//Load PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets ImageInfo from the first page.
PdfImageInfo[] imageInfo = document.Pages[0].ExtractImages();
//Gets the Image Boundary location.
RectangleF imageBounds = imageInfo[0].Bounds;
//Gets the Image stream.
Stream imageStream = imageInfo[0].ImageStream;
//Gets the Image index.
int imageIndex = imageInfo[0].Index;
//Gets the Image filter.
string[] imageFilter = imageInfo[0].ImageFilter;
//Closing the PDF document.
document.Close(true);
'Load PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
'Gets ImageInfo from the first page.
Dim imageInfo As PdfImageInfo() = document.Pages(0).ExtractImages()
'Gets the Image Boundary location.
Dim imageBounds As RectangleF = imageInfo(0).Bounds
'Gets the Image stream.
Dim imageStream As Stream = imageInfo(0).ImageStream
'Gets the Image index.
Dim imageIndex As Integer = imageInfo(0).Index
'Gets the Image filter.
Dim image As String() = imageInfo(0).ImageFilter
'Closing the PDF document.
document.Close(True)
ImageStream
Gets the image Stream.
Declaration
public Stream ImageStream { get; }
Property Value
Type |
---|
System.IO.Stream |
Examples
//Load PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets ImageInfo from the first page.
PdfImageInfo[] imageInfo = document.Pages[0].ExtractImages();
//Gets the Image Boundary location.
RectangleF imageBounds = imageInfo[0].Bounds;
//Gets the Image stream.
Stream imageStream = imageInfo[0].ImageStream;
//Gets the Image index.
int imageIndex = imageInfo[0].Index;
//Closing the PDF document.
document.Close(true);
'Load PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
'Gets ImageInfo from the first page.
Dim imageInfo As PdfImageInfo() = document.Pages(0).ExtractImages()
'Gets the Image Boundary location.
Dim imageBounds As RectangleF = imageInfo(0).Bounds
'Gets the Image stream.
Dim imageStream As Stream = imageInfo(0).ImageStream
'Gets the Image index.
Dim imageIndex As Integer = imageInfo(0).Index
'Closing the PDF document.
document.Close(True)
Index
Gets the Image index.
Declaration
public int Index { get; }
Property Value
Type |
---|
System.Int32 |
IsImageInterpolated
Returns true, when the image property in the PDF document is set to undergo interpolation.
Declaration
public bool IsImageInterpolated { get; }
Property Value
Type |
---|
System.Boolean |
IsImageMasked
Returns true, if image masking is applied. Set to true when the image is undergone image masking.
Declaration
public bool IsImageMasked { get; }
Property Value
Type |
---|
System.Boolean |
IsSoftMasked
Returns true, if soft masking is applied. Set to true when the image is undergone soft masking.
Declaration
public bool IsSoftMasked { get; }
Property Value
Type |
---|
System.Boolean |
Metadata
Gets XMP metadata of the image.
Declaration
public XmpMetadata Metadata { get; }
Property Value
Type |
---|
XmpMetadata |
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.
doc.Save("Output.pdf");
//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.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Examples
//Load PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets ImageInfo from the first page.
PdfImageInfo[] imageInfo = document.Pages[0].ExtractImages();
//Dispose ImageInfo.
imageInfo[0].Dispose();
//Closing the PDF document.
document.Close(true);
'Load PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
'Gets ImageInfo from the first page.
Dim imageInfo As PdfImageInfo() = document.Pages(0).ExtractImages()
'Dispose ImageInfo.
imageInfo(0).Dispose()
'Closing the PDF document.
document.Close(True)
Finalize()
Releases unmanaged resources and performs other cleanup operations before the PdfImageInfo is reclaimed by garbage collection.
Declaration
protected override void Finalize()
SaveImage(Stream)
Save the image to the stream
Declaration
public void SaveImage(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
Examples
//Load PDF document.
PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");
//Gets ImageInfo from the first page.
PdfImageInfo[] imageInfo = document.Pages[0].ExtractImages();
//Gets the Image Boundary location.
RectangleF imageBounds = imageInfo[0].Bounds;
//Save image into memory stream.
MemoryStream imageStream = new MemoryStream();
imageInfo[0].Save(imageStream);
//Closing the PDF document.
document.Close(true);
'Load PDF document.
Dim document As New PdfLoadedDocument("Input.pdf")
'Gets ImageInfo from the first page.
Dim imageInfo As PdfImageInfo() = document.Pages(0).ExtractImages()
'Gets the Image Boundary location.
Dim imageBounds As RectangleF = imageInfo(0).Bounds
'Save image into memory stream.
Dim imageStream As New MemoryStream()
imageInfo(0).Save(imageStream)
'Closing the PDF document.
document.Close(True)
Implements
System.IDisposable