←Select platform

GetPDFFileType Method

Summary

Gets the type of a PDF or Postscript file.

Syntax

C#
VB
C++
public static PDFFileType GetPDFFileType( 
   string fileName, 
   bool pdfTypesOnly 
) 
Public Shared Function GetPDFFileType( _ 
   ByVal fileName As String, _ 
   ByVal pdfTypesOnly As Boolean _ 
) As Leadtools.Pdf.PDFFileType 
public: 
static Leadtools.Pdf.PDFFileType GetPDFFileType(  
   String^ fileName, 
   bool pdfTypesOnly 
)  

Parameters

fileName
The name of the PDF or Postscript file.

pdfTypesOnly
true to recognize only PDF files (Postscript files will not be recognized), and PDFFileType.Unknown will be returned when fileName is a PS or EPS file. false to recognize both PDF and PS files.

Return Value

An PDFFileType enumeration member that specifies the type of the file. If the file is not PDF (or Postscript depending on pdfTypesOnly), then PDFFileType.Unknown is returned.

Remarks

The Load method will internally call GetPDFFileType with pdfTypesOnly set to true before loading the file properties.

Generally, when loading PDF files call GetPDFFileType first to determine whether the file provided by the user is a valid PDF. After that, it is best to call IsEncrypted to determine whether the file is encrypted and ask the user for a password before loading the file.

Example

For an example, refer to PDFCompatibilityLevel.

Requirements

Target Platforms

See Also

Reference

PDFFile Class

PDFFile Members

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

Leadtools.Pdf Assembly