←Select platform

StreamLength Property

Summary
The size in bytes of the embedded image.
Syntax
C#
C++/CLI
Java
Python
public long StreamLength { get; set; } 
public long getStreamLength(); 
public void setStreamLength( 
   long longValue 
); 
public: 
property int64 StreamLength { 
   int64 get(); 
   void set (    int64 ); 
} 
StreamLength # get and set (PDFImage) 

Property Value

The size in bytes of the embedded image.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
using Leadtools.WinForms; 
 
 
public void PDFDocumentImagesExample() 
{ 
   string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   string txtFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_pdfImageInfo.txt"); 
 
   // Save the results to the text file for examining 
   using (StreamWriter writer = File.CreateText(txtFileName)) 
   using (PDFDocument document = new PDFDocument(pdfFileName)) 
   { 
      // Look for image objects within the PDF 
      document.ParseDocumentStructure(PDFParseDocumentStructureOptions.Images); 
 
      // Output information about each image 
      foreach (PDFImage pdfImage in document.Images) 
         WritePdfImageProperties(writer, pdfImage); 
   } 
} 
 
public void WritePdfImageProperties(StreamWriter writer, PDFImage image) 
{ 
   writer.WriteLine("PDFImage.PageNumber: {0}", image.PageNumber.ToString()); 
   writer.WriteLine("  PDFImage.ObjectNumber: {0}", image.ObjectNumber.ToString()); 
   writer.WriteLine("  PDFImage.ColorDevice: {0}", image.ColorDevice.ToString()); 
   writer.WriteLine("  PDFImage.StreamOffset: {0}", image.StreamOffset.ToString()); 
   writer.WriteLine("  PDFImage.StreamLength: {0}", image.StreamLength.ToString()); 
   writer.WriteLine("  PDFImage.BitsPerComponent: {0}", image.BitsPerComponent.ToString()); 
   writer.WriteLine("  PDFImage.ComponentCount: {0}", image.ComponentCount.ToString()); 
   writer.WriteLine("  PDFImage.BitsPerPixel: {0}", image.BitsPerPixel.ToString()); 
   writer.WriteLine("  PDFImage.Width: {0}", image.Width.ToString()); 
   writer.WriteLine("  PDFImage.Height: {0}", image.Height.ToString()); 
   writer.WriteLine("  PDFImage.ImageType: {0}", image.ImageType.ToString()); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.BufferedWriter; 
import java.io.Console; 
import java.io.File; 
import java.io.FileWriter; 
import java.io.IOException; 
import java.io.OutputStream; 
import java.io.OutputStreamWriter; 
import java.nio.Buffer; 
import java.nio.file.Files; 
import java.nio.file.Path; 
import java.nio.file.Paths; 
import java.nio.file.StandardOpenOption; 
import java.sql.Date; 
import java.text.SimpleDateFormat; 
import java.time.LocalDateTime; 
import java.util.ArrayList; 
import java.util.List; 
 
import javax.xml.validation.Schema; 
 
import org.apache.lucene.store.Directory; 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.barcode.*; 
import leadtools.codecs.*; 
import leadtools.pdf.*; 
import leadtools.svg.*; 
 
 
public void pdfDocumentImagesExample() { 
   String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String pdfFileName = combine(LEAD_VARS_ImagesDir, "Leadtools.pdf"); 
   String txtFileName = combine(LEAD_VARS_ImagesDir, "LEAD_pdfImageInfo.txt"); 
 
   PDFDocument document = new PDFDocument(pdfFileName); 
   try (BufferedWriter writer = new BufferedWriter(new FileWriter(txtFileName))) { 
      document.parseDocumentStructure(PDFParseDocumentStructureOptions.IMAGES.getValue()); 
 
      for (PDFImage pdfImage : document.getImages()) { 
         writePdfImageProperties(writer, pdfImage); 
      } 
   } catch (Exception e) { 
      e.printStackTrace(); 
   } 
   assertTrue(new File(txtFileName).exists()); 
} 
 
public static void writePdfImageProperties(BufferedWriter writer, PDFImage image) throws IOException { 
   writer.write("PDFImage.PageNumber: " + image.getPageNumber()); 
   writer.newLine(); 
   writer.write("  PDFImage.ObjectNumber: " + image.getObjectNumber()); 
   writer.newLine(); 
   writer.write("  PDFImage.ColorDevice: " + image.getColorDevice()); 
   writer.newLine(); 
   writer.write("  PDFImage.StreamOffset: " + image.getStreamOffset()); 
   writer.newLine(); 
   writer.write("  PDFImage.StreamLength: " + image.getStreamLength()); 
   writer.newLine(); 
   writer.write("  PDFImage.BitsPerComponent: " + image.getBitsPerComponent()); 
   writer.newLine(); 
   writer.write("  PDFImage.ComponentCount: " + image.getComponentCount()); 
   writer.newLine(); 
   writer.write("  PDFImage.BitsPerPixel: " + image.getBitsPerPixel()); 
   writer.newLine(); 
   writer.write("  PDFImage.Width: " + image.getWidth()); 
   writer.newLine(); 
   writer.write("  PDFImage.Height: " + image.getHeight()); 
   writer.newLine(); 
   writer.write("  PDFImage.ImageType: " + image.getImageType()); 
   writer.newLine(); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.