←Select platform

PDFCompatibilityLevel Enumeration

Summary

Determines which compatibility (or version) level to use when creating or updating PDF files.

Syntax

C#
VB
C++
[SerializableAttribute()] 
public enum PDFCompatibilityLevel  
<SerializableAttribute()> 
Public Enum PDFCompatibilityLevel  
    
[SerializableAttribute()] 
public enum class PDFCompatibilityLevel  

Members

ValueMemberDescription
0Default Default (PDF version 1.5)
1PDF12 PDF version 1.2
2PDF13 PDF version 1.3
3PDF14 PDF version 1.4
4PDFA PDF/A
5PDF15 PDF version 1.5
Remarks

The PDFCompatibilityLevel enumeration is used by the PDFFile.CompatibilityLevel property and is used to determine which compatibility (or version) level to use when creating or updating PDF files.

The following methods of the PDFFile class will use PDFFile.CompatibilityLevel when creating new or updating existing PDF files:

Example

This example will check the version of a PDF file and convert it to PDF 1.4 if required.

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
using Leadtools.WinForms; 
 
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:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Pdf 
Imports Leadtools.WinForms 
Imports Leadtools.Svg 
Imports Leadtools.ImageProcessing 
 
Public Sub PDFCompatibilityLevelExample() 
   Dim sourceFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf") 
   Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_14.pdf") 
 
   ' Check the version of the source file 
   Dim fileType As PDFFileType = PDFFile.GetPDFFileType(sourceFileName, True) 
   If fileType = PDFFileType.Unknown Then 
      Console.WriteLine("Not a valid PDF file") 
      Return 
   End If 
 
   If fileType = PDFFileType.PDF14 Then 
      Console.WriteLine("Is PDF 1.4 already") 
      Return 
   End If 
 
   ' Not PDF 1.4, convert 
   Console.WriteLine("Converting to PDF 1.4") 
   Dim file As PDFFile = New PDFFile(sourceFileName) 
   file.CompatibilityLevel = PDFCompatibilityLevel.PDF14 
   file.Convert(1, -1, destFileName) 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 

Requirements

Target Platforms

See Also

Reference

Leadtools.Pdf Namespace

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly