GetFileInfo

GetFileInfo(string)

Returns the general information about a file.

public static FileInfo GetFileInfo(string filePath)
Parameter Type Description
filePath String The path to the file.

Return Value

An instance of FileInfo class.

Examples

The following code shows how to check whether a file is password-protected:

// Get a file info
Options.FileInfo info = Parser.GetFileInfo(filePath);
// Check IsEncrypted property
Console.WriteLine(info.IsEncrypted ? "Password is required" : "");

See Also


GetFileInfo(string, LoadOptions)

Returns the general information about a file.

public static FileInfo GetFileInfo(string filePath, LoadOptions loadOptions)
Parameter Type Description
filePath String The path to the file.
loadOptions LoadOptions The options to open the file.

Return Value

An instance of FileInfo class.

Examples

The following code shows how to check a file type of the password-protected document:

// Get a file info
Options.FileInfo info = Parser.GetFileInfo(filePath, new LoadOptions("password"));
// Check IsEncrypted property
Console.WriteLine(info.IsEncrypted ? "Password is required" : "");
// Print the file type
Console.WriteLine(info.FileType.ToString());

See Also


GetFileInfo(Stream)

Returns the general information about a file.

public static FileInfo GetFileInfo(Stream document)
Parameter Type Description
document Stream The source input stream.

Return Value

An instance of FileInfo class.

Examples

The following code shows how to check whether a file is password-protected:

// Get a file info
Options.FileInfo info = Parser.GetFileInfo(document);
// Check IsEncrypted property
Console.WriteLine(info.IsEncrypted ? "Password is required" : "");

See Also


GetFileInfo(Stream, LoadOptions)

Returns the general information about a file.

public static FileInfo GetFileInfo(Stream document, LoadOptions loadOptions)
Parameter Type Description
document Stream The source input stream.
loadOptions LoadOptions The options to open the file.

Return Value

An instance of FileInfo class.

Examples

The following code shows how to check a file type of the password-protected document:

// Get a file info
Options.FileInfo info = Parser.GetFileInfo(document);
// Check IsEncrypted property
Console.WriteLine(info.IsEncrypted ? "Password is required" : "");
// Print the file type
Console.WriteLine(info.FileType.ToString());

See Also