←Select platform

PDFContentType Enumeration

Summary
Specifies PDF content type.
Syntax
C#
C++/CLI
Java
Python
[SerializableAttribute()] 
public enum PDFContentType  
public final class PDFContentType 
    extends java.lang.Enum<PDFContentType> 
[SerializableAttribute()] 
public enum class PDFContentType  
class PDFContentType(Enum): 
   Text = 0 
   Image = 1 
   ImageOverText = 2 
Members
ValueMemberDescription
0Text PDF contains any content
1Image Page has an image only, no other content
2ImageOverText Page has an image over the content
Remarks

Used by PDFDocument.GetContentType to indicate the PDF content type.

Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
using Leadtools.WinForms; 
 
 
public void PDFDocumentGetContentTypeExample() 
{ 
   string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   string txtFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_pdfContent.txt"); 
 
   // Save the results to the text file for examining 
   using (StreamWriter writer = File.CreateText(txtFileName)) 
   using (PDFDocument document = new PDFDocument(pdfFileName)) 
      foreach (PDFDocumentPage page in document.Pages) 
      { 
         PDFContentType contentType = document.GetContentType(page.PageNumber); 
         writer.WriteLine("Page {0}: {1}", page.PageNumber, contentType.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 pdfDocumentGetContentTypeExample() throws IOException { 
   String LEAD_VARS_ImagesDir = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String pdfFileName = combine(LEAD_VARS_ImagesDir, "Leadtools.pdf"); 
   String txtFileName = combine(LEAD_VARS_ImagesDir, "LEAD_pdfContent.txt"); 
 
   // Save the results to the text file for examining 
   try (BufferedWriter writer = new BufferedWriter(new FileWriter(txtFileName))) { 
      PDFDocument document = new PDFDocument(pdfFileName); 
      for (PDFDocumentPage page : document.getPages()) { 
         PDFContentType contentType = document.getContentType(page.getPageNumber()); 
         writer.write(String.format("Page {%s}: {%s}", page.getPageNumber(), contentType.toString())); 
      } 
   } catch (Exception e) { 
      e.toString(); 
   } 
 
   assertTrue(new File(txtFileName).exists()); 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Pdf Namespace

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.