←Select platform

CompatibilityLevel Property

Summary
PDF compatibility level (version) to use when updating or creating a PDF file.
Syntax
C#
C++/CLI
Java
Python
public PDFCompatibilityLevel CompatibilityLevel { get; set; } 
public PDFCompatibilityLevel getCompatibilityLevel(); 
public void setCompatibilityLevel( 
   PDFCompatibilityLevel pDFCompatibilityLevel 
); 
public: 
property PDFCompatibilityLevel CompatibilityLevel { 
   PDFCompatibilityLevel get(); 
   void set (    PDFCompatibilityLevel ); 
} 
CompatibilityLevel # get and set (PDFFile) 

Property Value

A PDFCompatibilityLevel that specifies the PDF compatibility level (version) to use when this PDFFile is used to update or create a PDF file. Default value is PDFCompatibilityLevel.Default.

Remarks

The following methods of the PDFFile class will use the level set in CompatibilityLevel when updating or creating a PDF file:

Similar to the DocumentProperties property, the value of CompatibilityLevel will not be modified when a PDF file is loaded in this object using the Load method. To get the version of a PDF file, use the PDFFile.GetPDFFileType method.

Example
C#
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
 
 
public void PDFCompatibilityLevelExample() 
{ 
   string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_14.pdf"); 
 
   // Check the version of the source file 
   PDFFileType fileType = PDFFile.GetPDFFileType(sourceFileName, true); 
   if (fileType == PDFFileType.Unknown) 
   { 
      Console.WriteLine("Not a valid PDF file"); 
      return; 
   } 
 
   if (fileType == PDFFileType.PDF14) 
   { 
      Console.WriteLine("Is PDF 1.4 already"); 
      return; 
   } 
 
   // Not PDF 1.4, convert 
   Console.WriteLine("Converting to PDF 1.4"); 
   PDFFile file = new PDFFile(sourceFileName); 
   file.CompatibilityLevel = PDFCompatibilityLevel.PDF14; 
   file.Convert(1, -1, destFileName); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

PDFFile Class

PDFFile Members

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

Leadtools.Pdf Assembly

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