←Select platform

PDFCompatibilityLevel Enumeration

Summary
Determines which compatibility (or version) level to use when creating or updating PDF files.
Syntax
C#
C++/CLI
Java
Python
[SerializableAttribute()] 
public enum PDFCompatibilityLevel  
public final class PDFCompatibilityLevel 
    extends java.lang.Enum<PDFCompatibilityLevel> 
[SerializableAttribute()] 
public enum class PDFCompatibilityLevel  
class PDFCompatibilityLevel(Enum): 
   Default = 0 
   PDF12 = 1 
   PDF13 = 2 
   PDF14 = 3 
   PDFA = 4 
   PDF15 = 5 
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#
Java
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:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.ByteArrayInputStream; 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileNotFoundException; 
import java.io.FileOutputStream; 
import java.io.FileReader; 
import java.io.IOException; 
import java.io.InputStream; 
import java.nio.file.Files; 
import java.nio.file.Paths; 
import java.nio.file.StandardCopyOption; 
import java.util.ArrayList; 
import java.util.Date; 
import java.util.List; 
import java.util.Scanner; 
 
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.codecs.*; 
import leadtools.pdf.*; 
 
 
public void pdfFileCompatibilityLevelExample() { 
 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String sourceFileName = combine(LEAD_VARS_IMAGES_DIR, "Leadtools.pdf"); 
   String destFileName = combine(LEAD_VARS_IMAGES_DIR, "LEAD_14.pdf"); 
 
   // Check the version of the source file 
   PDFFileType fileType = PDFFile.getPDFFileType(sourceFileName, true); 
   if (fileType == PDFFileType.UNKNOWN) { 
      System.out.println("Not a valid PDF file"); 
      return; 
   } 
 
   if (fileType == PDFFileType.PDF14) { 
      System.out.println("Is PDF 1.4 already"); 
      return; 
   } 
 
   // Not PDF 1.4, convert 
   System.out.println("Converting to PDF 1.4"); 
   PDFFile file = new PDFFile(sourceFileName); 
   file.setCompatibilityLevel(PDFCompatibilityLevel.PDF14); 
   file.convert(1, -1, destFileName); 
 
   assertTrue(PDFFile.getPDFFileType(destFileName, true) == PDFFileType.PDF14); 
} 
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.