DocumentInfo
Contents
[
Hide
]
DocumentInfo class
Provides read-only metadata about a loaded document, such as its format, page count, title, and encryption status.
public class DocumentInfo
Properties
| Name | Description |
|---|---|
| Author { get; } | Gets the document author extracted from its metadata, or Empty if no author is available. |
| FileFormat { get; } | Gets the detected file format of the document. |
| IsEncrypted { get; } | Gets a value indicating whether the document is password-protected. |
| PageCount { get; } | Gets the number of pages in the document. For spreadsheets this returns the number of worksheets. |
| Title { get; } | Gets the document title extracted from its metadata, or Empty if no title is available. |
Remarks
Use GetDocumentInfo or GetInfo to obtain an instance of this class. The information is extracted from the source document without performing a full conversion, so it is a lightweight way to inspect a file before converting it.
Examples
Inspect a document before converting it:
// Using the static helper
DocumentInfo info = MarkdownConverter.GetInfo("report.docx");
Console.WriteLine($"Format: {info.FileFormat}");
Console.WriteLine($"Pages: {info.PageCount}");
Console.WriteLine($"Title: {info.Title}");
Console.WriteLine($"Author: {info.Author}");
if (info.IsEncrypted)
Console.WriteLine("The document is password-protected.");
Using the instance method:
using (var converter = new MarkdownConverter("spreadsheet.xlsx"))
{
DocumentInfo info = converter.GetDocumentInfo();
Console.WriteLine($"Worksheets: {info.PageCount}");
}
See Also
- namespace GroupDocs.Markdown
- assembly GroupDocs.Markdown