打开文档 
ComPDFKit 支持打开本地 PDF 文档或创建 PDF 文档。
打开本地 PDF 文档 
以下是使用文件路径打开一个 PDF 文档的步骤:
 1.获取本地文件路径。
 2.使用文件路径初始化CDFDocument对象。
以下是打开 PDF 文档的示例代码:
C#
CPDFDocument document = CPDFDocument.InitWithFilePath(myFilePath);// 使用PDF文件路径初始化CPDFDocument对象。
if(document.ErrorType != CPDFDocumentError.CPDFDocumentErrorSuccess
  && document.ErrorType != CPDFDocumentError.CPDFDocumentPasswordError)
{
    return;
}
if(document.IsLocked)//对已加密的文档,需要使用密码解除加密.
{
    document.UnlockWithPassword(password);
}创建 PDF 文档 
以下是创建 PDF 文档的示例代码:
C#
CPDFDocument document = CPDFDocument.CreateDocument();默认创建的新文档不包含任何页面,需要参阅”文档编辑“功能了解如何创建新页面,以及向文档中加入现有页面的详细信息。
打开文档状态说明 
以下是打开文档时的状态及其说明:
| 错误码 | 描述 | 
|---|---|
| CPDFDocumentErrorSuccess | 成功打开文档。 | 
| CPDFDocumentUnknownError | 未知错误。 | 
| CPDFDocumentFileError | 文件未找到或者不能被打开。 | 
| CPDFDocumentFormatError | 文件不是PDF格式或已损坏。 | 
| CPDFDocumentPasswordError | 需要密码或密码不正确。 | 
| CPDFDocumentSecurityError | 不支持的安全方案。 | 
| CPDFDocumentPageError | 页面未找到或内容错误。 |