Class PdfTiffImage
The PdfTiffImage contains methods and properties to handle the Bitmap images
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Imaging.NET.dll
Syntax
public class PdfTiffImage : PdfImage, IPdfWrapper, IDisposable
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
Constructors
PdfTiffImage(Stream)
Initializes a new instance of the PdfTiffImage class from the specified data stream.
Declaration
public PdfTiffImage(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream |
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
Load multi frame TIFF image
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
PdfTiffImage(Stream, Boolean)
Initializes a new instance of the PdfTiffImage class from the specified data stream.
Declaration
public PdfTiffImage(Stream stream, bool enableMetadata)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Boolean | enableMetadata |
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
Load multi frame TIFF image with enable XMP metadata extraction
PdfTiffImage tiffImage = new PdfTiffImage(imageStream, true);
//Get xmp metadata
XmpMetadata metadata = tiffImage.Metadata;
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image with enable XMP metadata extraction
Dim tiffImage As New PdfTiffImage(imageStream, true)
'Get xmp metadata
Dim metadata As XmpMetadata = tiffImage.Metadata
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
Properties
ActiveFrame
Gets or sets the active frame of the image.
Declaration
public int ActiveFrame { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
FrameCount
Gets frame count of the image.
Declaration
public int FrameCount { get; }
Property Value
Type |
---|
System.Int32 |
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
Height
Gets the height value of the image
Declaration
public override int Height { get; }
Property Value
Type |
---|
System.Int32 |
Overrides
Examples
// Create a new PDF document.
PdfDocument doc = new PdfDocument();
// Set page margins.
doc.PageSettings.Margins.All = 0;
// Load the multi-frame TIFF image from the disk.
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
// Get the frame count.
int frameCount = tiffImage.FrameCount;
// Get image height.
float imageHeight = tiffImage.Height;
// Access each frame and draw into the page.
for (int i = 0; i < frameCount; i++)
{
// Add a new page to the document.
PdfPage page = doc.Pages.Add();
// Get PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
// Set the active frame.
tiffImage.ActiveFrame = i;
// Draw the image onto the page.
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
// Create a stream object.
MemoryStream stream = new MemoryStream();
// Save the document as a stream.
doc.Save(stream);
// If the position is not set to '0', then the PDF will be empty.
stream.Position = 0;
// Close the document.
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the multi frame TIFF image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load the image from stream
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Get image height
Dim imageHeight As Single = image.Height
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
HorizontalResolution
Gets the horizontal resolution of the image.
Declaration
public override float HorizontalResolution { get; }
Property Value
Type |
---|
System.Single |
Overrides
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Get the horizontal resolution of the image.
float hResolution = tiffImage.HorizontalResolution;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Get the horizontal resolution.
Dim hResolution As Single = tiffImage.HorizontalResolution
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
Mask
Gets or sets the mask of bitmap.
Declaration
public PdfMask Mask { get; set; }
Property Value
Type | Description |
---|---|
PdfMask | New PdfMask represents the mask image. |
Examples
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Load the TIFF image
FileStream imageStream = new FileStream("image.tif", FileMode.Open, FileAccess.Read);
PdfBitmap image = new PdfBitmap(imageStream);
//Create masking image
FileStream maskStream = new FileStream("mask.bmp", FileMode.Open, FileAccess.Read);
PdfImageMask mask = new PdfImageMask(new PdfBitmap(maskStream));
image.Mask = mask;
//Draw the image
graphics.DrawImage(image, 0, 0);
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//Close the document
doc.Close(true);
'Create a PDF document
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Load the TIFF image
Dim imageStream As New FileStream("image.tif", FileMode.Open, FileAccess.Read)
'Load the TIFF image
Dim image As New PdfTiffImage(imageStream)
'Load the masking image
Dim maskStream As New FileStream("mask.bmp", FileMode.Open, FileAccess.Read)
'Create masking image
Dim mask As New PdfImageMask(New PdfTiffImage(maskStream))
image.Mask = mask
'Draw the image
graphics.DrawImage(image, 0, 0)
'Saves the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)
PhysicalDimension
Get the image physical dimension.
Declaration
public override SizeF PhysicalDimension { get; }
Property Value
Type |
---|
SizeF |
Overrides
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Get the physical dimension of the image.
float dimension = tiffImage.PhysicalDimension;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Get the physical dimension
Dim dimenstion As Single = tiffImage.PhysicalDimension
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
VerticalResolution
Gets the vertical resolution of the image.
Declaration
public override float VerticalResolution { get; }
Property Value
Type |
---|
System.Single |
Overrides
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Get the vertical resolution of the image.
float vResolution = tiffImage.VerticalResolution;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Get the vertical resolution.
Dim vResolution As Single = tiffImage.VerticalResolution
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
Width
Gets the width value of the image
Declaration
public override int Width { get; }
Property Value
Type |
---|
System.Int32 |
Overrides
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
PdfTiffImage tiffImage = new PdfTiffImage(imageStream);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Get image width
float imageWidth = tiffImage.Width;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(imageStream)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Get image width
Dim imageWidth As Single = image.Width
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Examples
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set page margins
doc.PageSettings.Margins.All = 0;
//Load the multi frame TIFF image from the disk
FileStream imageStream = new FileStream("image.tiff", FileMode.Open, FileAccess.Read);
//Load the image from stream
Image image = Image.FromStream(imageStream)
PdfTiffImage tiffImage = new PdfTiffImage(image);
//Get the frame count
int frameCount = tiffImage.FrameCount;
//Access each frame and draw into the page
for (int i = 0; i < frameCount; i++)
{
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;
tiffImage.ActiveFrame = i;
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
}
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document as stream
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty
stream.Position = 0;
//Close the document
doc.Close(true);
tiffImage.Dispose();
'Create a PDF document
Dim pdfDocument As New PdfDocument()
'Set page margins
pdfDocument.PageSettings.Margins.All = 0
'Load the image from the disk
Dim imageStream As New FileStream("image.tiff", FileMode.Open, FileAccess.Read)
Load the image from stream
Dim image As Image = Image.FromStream(imageStream)
'Load multi frame TIFF image
Dim tiffImage As New PdfTiffImage(Image)
'Get the frame count
Dim frameCount As Integer = tiffImage.FrameCount
'Access each frame and draw into the page
For i As Integer = 0 To frameCount - 1
Dim page As PdfPage = pdfDocument.Pages.Add()
Dim graphics As PdfGraphics = page.Graphics
tiffImage.ActiveFrame = i
graphics.DrawImage(tiffImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height)
Next
Dim stream As New MemoryStream()
'Save and close the document
pdfDocument.Save(stream)
pdfDocument.Close(True)
tiffImage.Dispose()
Finalize()
Releases unmanaged resources and performs other cleanup operations before the PdfTiffImage is reclaimed by garbage collection.
Declaration
protected override void Finalize()