←Select platform

PDFFile Constructor(string)

Summary
Initializes a new PDFFile object and associates it with the name of a PDF file.
Syntax
C#
C++/CLI
Java
Python
public PDFFile( 
   string fileName 
) 
public PDFFile( 
   java.lang.String fileName 
); 
public: 
PDFFile(  
   String^ fileName 
) 
__init__(self,fileName) # Overloaded constructor 

Parameters

fileName
The name of the file to be associated with this PDFFile.

Remarks

This constructor will initialize the properties of the PDFFile object as follows:

After the filename and optional password are set, call the Load method to populate the DocumentProperties and Pages properties of this PDFFile object with the values read from the file.

In certain situation, you may want to associate a PDFFile with a Postscript and not a PDF file. For example, to create a PDFFile object and call its Distill method to convert the Postscript file to PDF.

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 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; 
   file.SetDocumentProperties(destFileName); 
 
   // Show the properties of the new file 
   ShowProperties("Destination file", destFileName); 
} 
 
private static void ShowProperties(string message, string fileName) 
{ 
   Console.WriteLine(message); 
 
   // Get the properties of the file 
   PDFFile file = new PDFFile(fileName); 
   file.Load(); 
 
   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); 
   Console.WriteLine("----------:"); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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.