IDocumentInfo
内容
[
隐藏
]
IDocumentInfo interface
定义获取基本文档信息所需的方法。
public interface IDocumentInfo
特性
姓名 | 描述 |
---|---|
FileType { get; } | 获取文件格式描述。 |
PageCount { get; } | 获取总页数。 |
Pages { get; } | 获取列表PageInfo 页面信息. |
Size { get; } | 以字节为单位获取文档大小。 |
评论
了解更多
例子
以下示例演示如何使用检索一般文档信息IDocumentInfo
.
try
{
using (Redactor red = new Redactor(@"C:\Temp\testfile.doc"))
{
IDocumentInfo docInfo = red.GetDocumentInfo();
Console.WriteLine("Document size: {0}", docInfo.Size);
Console.WriteLine("Document format: {0}", docInfo.FileType.FileFormat);
Console.WriteLine("Document contains {0} pages", docInfo.PageCount);
foreach (PageInfo page in docInfo.Pages)
{
Console.WriteLine("Page {0} size is {1}x{2}", page.PageNumber, page.Width, page.Height);
}
}
}
catch (GroupDocs.Redaction.Exceptions.PasswordRequiredException)
{
Console.WriteLine("You are trying to access document which is password protected. Please, set the password.");
}
catch (GroupDocs.Redaction.Exceptions.IncorrectPasswordException)
{
Console.WriteLine("The provided password is not valid.");
}