public RasterImage DecodeImage(string imageObjectNumber)
Public Function DecodeImage( _ByVal imageObjectNumber As String _) As RasterImage
public RasterImage decodeImage(String imageObjectNumber) public:RasterImage^ DecodeImage(String^ imageObjectNumber)
imageObjectNumber
String that specifies the PDF image object number to decode.
A Leadtools.RasterImage object.
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";}
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
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
