←Select platform

GetContentType Method

Summary
Gets the content type for the specified page of this PDFDocument.
Syntax
C#
VB
C++
Java
public PDFContentType GetContentType( 
   int pageNumber 
) 
Public Function GetContentType( _ 
   ByVal pageNumber As Integer _ 
) As PDFContentType 
public PDFContentType getContentType( 
   int pageNumber 
); 
public: 
PDFContentType GetContentType(  
   int pageNumber 
)  

Parameters

pageNumber
The page number to check.

Return Value

A PDFContentType that indicates the content type for the specified page.

Remarks

Use CodecsPdfLoadOptions.DropImageOverText to control whether the overlay image is dropped when loading the PDF page as a raster or SVG image.

Example
C#
VB
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:\LEADTOOLS21\Resources\Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Controls 
Imports Leadtools.Pdf 
Imports Leadtools.Svg 
Imports Leadtools.WinForms 
 
Public Sub PDFDocumentGetContentTypeExample() 
   Dim pdfFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf") 
   Dim txtFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_pdfContent.txt") 
 
   ' Save the results to the text file for examining 
   Using writer As StreamWriter = File.CreateText(txtFileName) 
      Using document As PDFDocument = New PDFDocument(pdfFileName) 
         For Each page As PDFDocumentPage In document.Pages 
            Dim contentType As PDFContentType = document.GetContentType(page.PageNumber) 
            writer.WriteLine("Page {0}: {1}", page.PageNumber, contentType.ToString()) 
         Next page 
      End Using 
   End Using 
End Sub 
 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

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

Leadtools.Pdf Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.