Error processing SSI file
LEADTOOLS PDF (Leadtools.Pdf assembly)

Show in webframe

PDFFile Class






Members 
PDF file features class. * PDF Capability Required.
Object Model
Syntax
[SerializableAttribute()]
public class PDFFile 
'Declaration
 
<SerializableAttribute()>
Public Class PDFFile 
'Usage
 
Dim instance As PDFFile
[SerializableAttribute()]
public ref class PDFFile 
Remarks

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

All of 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# and VB PDF File Demos shipped with LEADTOOLS contain a wizard-style user interface to perform all of 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.

*NOTE: This class is only included as part of our Advanced PDF Plugin. If you receive a "PDF Capability Required" error, please check that your license supports this plugin before using these classes in an unlocked application.

Example

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

Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Pdf
Imports Leadtools.WinForms
Imports Leadtools.Svg
Imports Leadtools.ImageProcessing

<TestMethod> _
Public Sub PDFFileExample()
   Dim sourceFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf")
   Dim destFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_14.pdf")
   ' Load the properties of the file
   ShowProperties("Source file", sourceFileName)

   ' Update the properties of the file
   Dim file As PDFFile = 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)
End Sub

Private Shared Sub ShowProperties(ByVal message As String, ByVal fileName As String)
   Console.WriteLine(message)

   ' Get the properties of the file
   Dim file As PDFFile = New PDFFile(fileName)
   file.Load()

   Dim props As PDFDocumentProperties = 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("----------:")
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.Pdf;
using Leadtools.Svg;
using Leadtools.WinForms;

[TestMethod]
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:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms

See Also

Reference

PDFFile Members
Leadtools.Pdf Namespace
PDFDocument Class
PDFFilePage Structure
Programming with LEADTOOLS PDF

Error processing SSI file
   Leadtools.Pdf requires a PDF Pro, Pro Suite, Document, or Medical license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features