←Select platform

PDFFile Class


PDF file features class.


public class PDFFile 
public class PDFFile 
public ref class PDFFile  
class PDFFile: 


The PDFFile class allows the following actions on Adobe Document Format (PDF) and Postscript (PS) files:

All the methods described above can set the compatibility level (version) of the created or updated PDF using the CompatibilityLevel property, update its properties using the DocumentProperties property or set the security and encryption mode using the SecurityOptions property.

To use most of these properties methods, construct a PDFFile object with the PDF file and optional password before performing the action.

The C# PDF File Demos shipped with LEADTOOLS contain a wizard-style user interface to perform all the above actions on existing PDF and PS files.

You can also use the PDFDocument class to parse a PDF file and extract its objects such as text (without invoking OCR), images, hyperlinks, annotations, form fields, digital signatures, internal links and bookmarks.


This example will show the properties of an existing PDF file, update its properties and then save the file to a new file.

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 PDFFileExample() 
   string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_14.pdf"); 
   // Load the properties of the file 
   ShowProperties("Source file", sourceFileName); 
   // Update the properties of the file 
   PDFFile file = new PDFFile(sourceFileName); 
   file.DocumentProperties = new PDFDocumentProperties(); 
   file.DocumentProperties.Author = "Me"; 
   file.DocumentProperties.Title = "My title"; 
   file.DocumentProperties.Subject = "My subject"; 
   file.DocumentProperties.Creator = "My application"; 
   file.DocumentProperties.Modified = DateTime.Now; 
   // Show the properties of the new file 
   ShowProperties("Destination file", destFileName); 
private static void ShowProperties(string message, string fileName) 
   // Get the properties of the file 
   PDFFile file = new PDFFile(fileName); 
   PDFDocumentProperties props = file.DocumentProperties; 
   Console.WriteLine("  Title: {0}", props.Title); 
   Console.WriteLine("  Author: {0}", props.Author); 
   Console.WriteLine("  Subject: {0}", props.Subject); 
   Console.WriteLine("  Keywords: {0}", props.Keywords); 
   Console.WriteLine("  Creator: {0}", props.Creator); 
   Console.WriteLine("  Producer: {0}", props.Producer); 
   Console.WriteLine("  Created: {0}", props.Created); 
   Console.WriteLine("  Modified: {0}", props.Modified); 
static class LEAD_VARS 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 


Target Platforms

See Also

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.