Decodes the specified PDF image object embedded in this PDFDocument.
public Leadtools.RasterImage DecodeImage(string imageObjectNumber)
Public Function DecodeImage( _ByVal imageObjectNumber As String _) As Leadtools.RasterImage
public RasterImage decodeImage(String imageObjectNumber)public:Leadtools.RasterImage^ DecodeImage(String^ imageObjectNumber)
imageObjectNumber
String that specifies the PDF image object number to decode.
A Leadtools.RasterImage object.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ControlsImports Leadtools.PdfImports Leadtools.SvgImports Leadtools.WinFormsPublic Sub PDFDocumentDecodeImageExample()Dim sourceFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf")Dim destinationFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_pdfDecodeImage.tif")Using document As PDFDocument = New PDFDocument(sourceFileName)document.Resolution = 200' Parse the objects in all pagesdocument.ParsePages(PDFParsePagesOptions.Objects, 1, -1)Dim codecs As RasterCodecs = New RasterCodecs()For Each page As PDFDocumentPage In document.PagesIf Not page.Objects Is Nothing AndAlso page.Objects.Count > 0 ThenFor Each obj As PDFObject In page.ObjectsIf obj.ObjectType = PDFObjectType.Image ThenUsing image As RasterImage = document.DecodeImage(obj.ImageObjectNumber)codecs.Save(image, destinationFileName, RasterImageFormat.TifLzw, image.BitsPerPixel, 1, 1, -1, CodecsSavePageMode.Append)End UsingEnd IfNext objEnd IfNext pagecodecs.Dispose()End UsingEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Controls;using Leadtools.Pdf;using Leadtools.Svg;using Leadtools.WinForms;public void PDFDocumentDecodeImageExample(){string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf");string destinationFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_pdfDecodeImage.tif");using (PDFDocument document = new PDFDocument(sourceFileName)){document.Resolution = 200;// Parse the objects in all pagesdocument.ParsePages(PDFParsePagesOptions.Objects, 1, -1);RasterCodecs codecs = new RasterCodecs();foreach (PDFDocumentPage page in document.Pages)if (page.Objects != null && page.Objects.Count > 0)foreach (PDFObject obj in page.Objects)if (obj.ObjectType == PDFObjectType.Image)using (RasterImage image = document.DecodeImage(obj.ImageObjectNumber))codecs.Save(image, destinationFileName, RasterImageFormat.TifLzw, image.BitsPerPixel, 1, 1, -1, CodecsSavePageMode.Append);codecs.Dispose();}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: DecodeImage Method - Leadtools.Pdf |
Introduction |
Help Version 19.0.2017.3.22
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.