Documentize Namespace 的子部分
Class AddTimestampOptions
信息
表示用于 Documentize.Timestamp 插件的添加时间戳选项。
[Obsolete("该类将很快被删除。请使用 SignOptions 类。")]
public class AddTimestampOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
AddTimestampOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
AddTimestampOptions(Stream, string, string, string)
使用默认选项初始化 Documentize.AddTimestampOptions 对象的新实例。
public AddTimestampOptions(Stream pfx, string password, string serverUrl, string serverBasicAuthCredentials = "")
参数
pfx Stream: pfx 文件的路径。password string: pfx 文件的密码。serverUrl string: 时间戳服务器的 URL。serverBasicAuthCredentials string: 基本身份验证凭据,用户名和密码组合为字符串 “username:password”。 (可选)。
AddTimestampOptions(string, string, string, string)
使用默认选项初始化 Documentize.AddTimestampOptions 对象的新实例。
public AddTimestampOptions(string pfx, string password, string serverUrl, string serverBasicAuthCredentials = "")
参数
pfx string: pfx 文件的路径。password string: pfx 文件的密码。serverUrl string: 时间戳服务器的 URL。serverBasicAuthCredentials string: 基本身份验证凭据,用户名和密码组合为字符串 “username:password”。 (可选)。
Class ChatCompletion
public class ChatCompletion
继承
object ←
ChatCompletion
继承成员
构造函数
ChatCompletion()
属性
Choices
聊天完成选择的列表。如果 n 大于 1,可以有多个选择。
[JsonProperty("choices")]
public List<choice> Choices { get; set; }
属性值
List<Choice>
Created
聊天完成创建时的 Unix 时间戳(以秒为单位)。
[JsonProperty("created")]
public long Created { get; set; }
属性值
long
Id
聊天完成的唯一标识符。
[JsonProperty("id")]
public string Id { get; set; }
属性值
string
Model
用于聊天完成的模型。
[JsonProperty("model")]
public string Model { get; set; }
属性值
string
Object
对象类型,始终为 chat.completion。
[JsonProperty("object")]
public string Object { get; set; }
属性值
string
SystemFingerprint
此指纹代表模型运行的后端配置。
[JsonProperty("system_fingerprint")]
public string SystemFingerprint { get; set; }
属性值
string
Usage
完成请求的使用统计信息。
[JsonProperty("usage")]
public Usage Usage { get; set; }
属性值
Usage
Class ChatGptConsts
public static class ChatGptConsts
继承
object ←
ChatGptConsts
继承的成员
字段
字段值
string
ModelName
public static string ModelName
字段值
string
SystemRole
public static string SystemRole
字段值
string
SystemRoleDescription
public static string SystemRoleDescription
字段值
string
UserRole
public static string UserRole
字段值
string
Class ChatGptRequestOptions
信息
表示 Documentize.PdfManager 插件的选项。
public class ChatGptRequestOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
ChatGptRequestOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
ChatGptRequestOptions()
使用默认选项初始化 Documentize.ChatGptRequestOptions 对象的新实例。
public ChatGptRequestOptions()
ChatGptRequestOptions(string, string, string, string)
使用选项初始化 Documentize.ChatGptRequestOptions 对象的新实例。
public ChatGptRequestOptions(string apiKey, string model, string apiUrl, string query)
参数
属性
ApiKey
获取或设置访问 ChatGPT API 的密钥。
public string ApiKey { get; set; }
属性值
string
ApiUrl
获取或设置 ChatGPT API 的 URL。
public string ApiUrl { get; set; }
属性值
string
CancellationToken
取消令牌。
public CancellationToken CancellationToken { get; set; }
属性值
CancellationToken
MaxTokens
响应中最大令牌数。
默认值为 null,表示无限。
public int? MaxTokens { get; set; }
属性值
int?
Messages
获取或设置 Documentize.Message 对象的集合。
public List<message> Messages { get; set; }
属性值
List<Message>
备注
当向选项中添加多个消息时,消息集合的顺序如下:
- 第一条消息(如果有)来自 options.Query,前面加上内容为:“You are a helpful assistant.” 的消息,并且角色为“system”。
- 然后(如果有)添加来自 options.Messages 集合的消息。
- 最后,来自文件源的消息(如果有)会添加,针对每个文档添加一个具有“user”角色的消息对象。
如果没有提供任何消息,将抛出 ArgumentException。
Model
设置或获取要使用的模型的 ID。
public string Model { get; set; }
属性值
string
NumberOfChoices
为每个输入消息生成多少个聊天完成选项。
public int NumberOfChoices { get; set; }
属性值
int
Query
获取或设置发送给 ChatGPT 的字符串请求。
如果不为空,这将在请求中作为集合中的第一条消息发送。
public string Query { get; set; }
属性值
string
Temperature
使用的采样温度,介于 0 和 2 之间。
较高的值如 0.8 会使输出更随机,而较低的值如 0.2 会使其更集中和确定。
默认值为 1。
public double Temperature { get; set; }
属性值
double
Class Choice
继承
object ←
Choice
继承成员
构造函数
Choice()
属性
FinishReason
模型停止生成标记的原因。
如果模型达到自然停止点或
提供的停止序列,或者达到请求中指定的标记最大数量,将停止生成。
[JsonProperty("finish_reason")]
public string FinishReason { get; set; }
属性值
string
Index
选择列表中选择的索引。
[JsonProperty("index")]
public int Index { get; set; }
属性值
int
Message
模型生成的聊天完成消息。
[JsonProperty("message")]
public Message Message { get; set; }
属性值
Message
Class CompressOptions
信息
表示 Documentize.PdfManager 插件的压缩选项。
public sealed class CompressOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
CompressOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
CompressOptions()
使用默认选项初始化 Documentize.CompressOptions 对象的新实例。
Class DecryptionOptions
信息
表示 Documentize.Security 插件的解密选项。
public class DecryptionOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
DecryptionOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
DecryptionOptions(string)
使用默认选项初始化 Documentize.DecryptionOptions 对象的新实例。
public DecryptionOptions(string ownerPassword)
参数
属性
OwnerPassword
拥有者密码。
public string OwnerPassword { get; set; }
属性值
string
Class DecryptOptions
信息
表示 Documentize.PdfSecurity 插件的解密选项。
public class DecryptOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
DecryptOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
DecryptOptions(string)
使用默认选项初始化 Documentize.DecryptOptions 对象的新实例。
public DecryptOptions(string ownerPassword)
参数
属性
OwnerPassword
所有者密码。
public string OwnerPassword { get; set; }
属性值
string
Class DirectoryDataSource
public sealed class DirectoryDataSource : IDataSource
继承
object ←
DirectoryDataSource
实现
继承成员
构造函数
DirectoryDataSource(string)
使用指定路径初始化新的目录数据。
public DirectoryDataSource(string path)
参数
属性
DataType
数据源的类型。
public DataType DataType { get; }
属性值
DataType
Path
获取当前数据的目录路径。
public string Path { get; }
属性值
string
Class DocConverter
信息
表示 Documentize.DocConverter 插件。用于将 PDF 文档转换为 DOC/DOCX 格式。
[Obsolete("该类将很快被删除。请使用 PdfConverter 类。")]
public static class DocConverter
继承
object ←
DocConverter
继承成员
方法
Process(PdfToDocOptions)
将 PDF 文档转换为 DOC/DOCX 格式。
public static ResultContainer Process(PdfToDocOptions options)
参数
返回值
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class EncryptionOptions
信息
表示 Documentize.Security 插件的加密选项。
public class EncryptionOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
EncryptionOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
EncryptionOptions(string, string)
使用默认选项初始化 Documentize.EncryptionOptions 对象的新实例。
public EncryptionOptions(string ownerPassword, string userPassword)
参数
属性
OwnerPassword
拥有者密码。
public string OwnerPassword { get; set; }
属性值
string
UserPassword
用户密码。
public string UserPassword { get; set; }
属性值
string
Class EncryptOptions
信息
表示 Documentize.PdfSecurity 插件的加密选项。
public class EncryptOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
EncryptOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
EncryptOptions(string, string)
用默认选项初始化 Documentize.EncryptOptions 对象的新实例。
public EncryptOptions(string ownerPassword, string userPassword)
参数
属性
OwnerPassword
拥有者密码。
public string OwnerPassword { get; set; }
属性值
string
UserPassword
用户密码。
public string UserPassword { get; set; }
属性值
string
信息
表示用于 Documentize.PdfExtractor 插件的字段值导出选项。
public sealed class ExtractFormDataToDsvOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
ExtractFormDataToDsvOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
初始化 Documentize.ExtractFormDataToDsvOptions 对象的新实例。
public ExtractFormDataToDsvOptions(char delimeter = ',', bool addFieldNames = false)
参数
delimeter char: 指定导出数据中值之间使用的分隔符。默认值为 ‘,’。addFieldNames bool: 在值之前添加字段名称。格式: 名称 + 分隔符 + 值 + 分隔符。
属性
在值之前添加字段名称。
格式: 名称 + 分隔符 + 值 + 分隔符。
public bool AddFieldName { get; set; }
属性值
bool
用于导出值的分隔符。
public char Delimeter { get; set; }
属性值
char
信息
表示 Documentize.PdfExtractor 插件的图像提取选项。
public sealed class ExtractImagesOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
ExtractImagesOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
使用默认选项初始化 Documentize.ExtractImagesOptions 对象的新实例。
public ExtractImagesOptions()
Class FileDataSource
public sealed class FileDataSource : IDataSource
继承
object ←
FileDataSource
实现
继承的成员
构造函数
FileDataSource(string)
使用指定路径初始化新的文件数据源。
public FileDataSource(string path)
参数
属性
DataType
数据源的类型。
public DataType DataType { get; }
属性值
DataType
Path
获取当前数据文件的路径。
public string Path { get; }
属性值
string
Class FileResult
public sealed class FileResult : IOperationResult
继承
object ←
FileResult
实现
继承成员
属性
Data
获取原始数据。
public object Data { get; }
属性值
object
IsFile
指示结果是否是输出文件的路径。
public bool IsFile { get; }
属性值
bool
IsStream
指示结果是否是输出流。
public bool IsStream { get; }
属性值
bool
IsString
指示结果是否是文本字符串。
public bool IsString { get; }
属性值
bool
方法
ToFile()
尝试将结果转换为文件。
返回
string : 如果结果是文件,则表示输出文件路径的字符串;否则为 null。
ToStream()
尝试将结果转换为流对象。
返回
Stream : 如果结果是流,则表示输出数据的流对象;否则为 null。
信息
表示 Documentize.FormExporter 插件。用于将 PDF 文档的表单值导出为 DSV 或 CSV 文件。
[Obsolete("该类将很快被删除。请使用 PdfExtractor 类。")]
public static class FormExporter
继承
object ←
FormExporter
继承成员
方法
使用指定的参数开始 Documentize.FormExporter 处理。
public static ResultContainer Process(ExtractFormDataToDsvOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置 options。
信息
表示 Documentize.FormExporter 插件字段导出值的选项。
public sealed class FormExportToDsvOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
FormExportToDsvOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
初始化 Documentize.FormExportToDsvOptions 对象的新实例。
public FormExportToDsvOptions(char delimeter = ',', bool addFieldNames = false)
参数
delimeter char: 指定导出数据中值之间使用的分隔符。默认值为 ‘,’。addFieldNames bool: 在值之前添加字段名称。格式:名称 + 分隔符 + 值 + 分隔符。
属性
在值之前添加字段名称。
格式:名称 + 分隔符 + 值 + 分隔符。
public bool AddFieldName { get; set; }
属性值
bool
用于导出值的分隔符。
public char Delimeter { get; set; }
属性值
char
信息
表示 Documentize.FormFlattener 插件。用于扁平化 PDF 文档中的字段。
public static class FormFlattener
继承
object ←
FormFlattener
继承成员
示例
该示例演示了如何扁平化 PDF 文件中的字段。
// 创建 FormFlattenerOptions 对象以设置指令
var options = new FormFlattenerOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
FormFlattener.Process(options);
该示例演示如何扁平化 PDF 文件中的字段并跳过第一个字段。
// 获取字段名称
var fieldNames = FormFlattener.GetFieldNames("path_to_your_pdf_file.pdf");
// 创建 FormFlattenerOptions 对象以设置指令
var options = new FormFlattenerOptions();
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 跳过1个字段。
options.SkipFields.Add(fieldNames[0]);
// 执行处理
FormFlattener.Process(options);
该示例演示如何从 PDF 文件中获取字段名称。
// 获取字段名称
var fieldNames = FormFlattener.GetFieldNames("path_to_your_pdf_file.pdf");
方法
获取 PDF 文档中的字段名称。
public static List<string> GetFieldNames(string path)
参数
返回
List<string>
PDF 文档中的名称列表。
public static List<string> GetFieldNames(Stream stream)
参数
返回
List<string>
PDF 文档中的名称列表。
public static ResultContainer Process(FormFlattenerOptions options)
参数
返回
ResultContainer: 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
信息
代表 Documentize.FormFlattener 插件在文档中扁平化字段的选项。
public class FormFlattenerOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
FormFlattenerOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
使用默认选项初始化 Documentize.FormFlattenerOptions 对象的新实例。
public FormFlattenerOptions()
属性
将不被扁平化的字段列表。
public List<string> SkipFields { get; set; }
属性值
List<string>
Class HtmlConverter
信息
表示 Documentize.HtmlConverter 插件。用于将 PDF 文档转换为 HTML 格式,以及将 HTML 文档转换为 PDF 格式。
[Obsolete("该类将很快被删除。请使用 PdfConverter 类。")]
public static class HtmlConverter
继承
object ←
HtmlConverter
继承成员
方法
Process(PdfToHtmlOptions)
将 PDF 文档转换为 HTML 格式。
public static ResultContainer Process(PdfToHtmlOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置 options。
Process(HtmlToPdfOptions)
将 HTML 文档转换为 PDF 格式。
public static ResultContainer Process(HtmlToPdfOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置 options。
Class HtmlToPdfOptions
信息
表示 Documentize.PdfConverter 插件的 HTML 到 PDF 转换器选项。
public sealed class HtmlToPdfOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
HtmlToPdfOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
HtmlToPdfOptions()
初始化 Documentize.HtmlToPdfOptions 对象的新实例。
public HtmlToPdfOptions()
属性
BasePath
html 文件的基本路径/url。
public string BasePath { get; set; }
属性值
string
获取或设置渲染期间使用的可能媒体类型。
public HtmlMediaType HtmlMediaType { get; set; }
属性值
HtmlMediaType
IsRenderToSinglePage
获取或设置将所有文档渲染为单页。
public bool IsRenderToSinglePage { get; set; }
属性值
bool
PageInfo
获取或设置文档页面信息。
public PageInfo PageInfo { get; set; }
属性值
PageInfo
PageLayoutOption
获取或设置布局选项。
public HtmlPageLayoutOption PageLayoutOption { get; set; }
属性值
HtmlPageLayoutOption
信息
表示 Documentize.ImageExtractor 插件,用于从 PDF 文档中提取图像。
[Obsolete("该类将很快被删除。请使用 PdfExtractor 类。")]
public static class ImageExtractor
继承关系
object ←
ImageExtractor
继承成员
方法
从 PDF 文档中提取图像。
public static ResultContainer Process(ExtractImagesOptions options)
参数
返回值
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果选项未设置。
信息
表示 Documentize.ImageExtractor 插件的图像提取选项。
public sealed class ImageExtractorOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
ImageExtractorOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
使用默认选项初始化 Documentize.ImageExtractorOptions 对象的新实例。
public ImageExtractorOptions()
Class JpegConverter
信息
表示 Documentize.JpegConverter 插件。用于将 PDF 文档转换为 JPEG 格式。
[Obsolete("该类将很快被删除。请使用 PdfConverter 类。")]
public static class JpegConverter
继承
object ←
JpegConverter
继承成员
方法
Process(PdfToJpegOptions)
将 PDF 文档转换为 JPEG 格式。
public static ResultContainer Process(PdfToJpegOptions options)
参数
返回值
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class MergeOptions
信息
表示 Documentize.PdfManager 插件的合并选项。
public sealed class MergeOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
MergeOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
MergeOptions()
使用默认选项初始化 Documentize.MergeOptions 对象的新实例。
Class Merger
信息
表示 Documentize.Merger 插件。用于将多个 PDF 文档合并为一个 PDF。
[Obsolete("该类将很快被删除。请使用 PdfManager 类。")]
public static class Merger
继承
object ←
Merger
继承成员
方法
Process(MergeOptions)
合并 PDF 文档。
public static ResultContainer Process(MergeOptions options)
参数
返回值
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class Message
继承
object ←
Message
继承的成员
构造函数
Message()
属性
内容
消息的内容。
[JsonProperty("content")]
public string Content { get; set; }
属性值
string
角色
设置或获取此消息作者的角色。
[JsonProperty("role")]
[JsonConverter(typeof(StringEnumConverter), new object[] { true })]
public Role Role { get; set; }
属性值
Role
Class ObjectResult
public sealed class ObjectResult : IOperationResult
继承
object ←
ObjectResult
实现
继承成员
属性
Data
获取原始数据。
public object Data { get; }
属性值
object
IsFile
指示结果是否为输出文件的路径。
public bool IsFile { get; }
属性值
bool
IsObject
指示结果是否为对象。
public bool IsObject { get; }
属性值
bool
IsStream
指示结果是否为输出文件的路径。
public bool IsStream { get; }
属性值
bool
IsString
指示结果是否为字符串。
public bool IsString { get; }
属性值
bool
Text
返回结果的字符串表示。
public string Text { get; }
属性值
string
方法
ToFile()
尝试将结果转换为文件。
返回
string : 如果结果是文件,则返回表示输出文件路径的字符串;否则返回 null。
ToStream()
尝试将结果转换为流对象。
返回
Stream : 如果结果是流,则返回表示输出数据的流对象;否则返回 null。
ToString()
尝试将结果转换为字符串。
public override string ToString()
返回
string : 如果结果是字符串,则返回表示文本内容的字符串;否则返回 base.ToString()。
Class OptimizeOptions
信息
表示 Documentize.PdfManager 插件的优化选项。
public sealed class OptimizeOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
OptimizeOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
OptimizeOptions()
初始化一个 Documentize.OptimizeOptions 对象的新实例,使用默认选项。
将文档线性化,以便
- 尽快打开第一页;
- 尽可能快速地显示下一页或通过链接跟随到下一页;
- 以增量方式显示页面,随着页面数据通过慢速通道传送而到达(首先显示最有用的数据);
- 允许用户交互,例如在整个页面被接收和显示之前,跟随链接。
Class Optimizer
信息
表示 Documentize.Optimizer 插件。用于优化、旋转、调整大小、压缩 PDF 文档。
[Obsolete("该类将很快被删除。请使用 PdfManager 类。")]
public static class Optimizer
继承
object ←
Optimizer
继承成员
方法
Process(OptimizeOptions)
使用指定的参数开始 Documentize.Optimizer 处理。
public static ResultContainer Process(OptimizeOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
Process(RotateOptions)
使用指定的参数开始 Documentize.Optimizer 处理。
public static ResultContainer Process(RotateOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
Process(ResizeOptions)
使用指定的参数开始 Documentize.Optimizer 处理。
public static ResultContainer Process(ResizeOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
Process(CompressOptions)
使用指定的参数开始 Documentize.Optimizer 处理。
public static ResultContainer Process(CompressOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
Class PageInfo
public class PageInfo : PageSize
继承
object ←
PageSize ←
PageInfo
继承成员
- PageSize.Width,
- PageSize.Height,
- PageSize.IsLandscape,
- PageSize.A0,
- PageSize.A1,
- PageSize.A2,
- PageSize.A3,
- PageSize.A4,
- PageSize.A5,
- PageSize.A6,
- PageSize.B5,
- PageSize.PageLetter,
- PageSize.PageLegal,
- PageSize.PageLedger,
- PageSize.P11x17,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PageInfo()
Documentize.PageInfo的构造函数。
PageInfo(double, double)
Documentize.PageInfo的构造函数。
public PageInfo(double width, double height)
参数
属性
MarginBottom
获取或设置表示底部边距的值。
public double MarginBottom { get; set; }
属性值
double
MarginLeft
获取或设置表示左侧边距的值。
public double MarginLeft { get; set; }
属性值
double
MarginRight
获取或设置表示右侧边距的值。
public double MarginRight { get; set; }
属性值
double
MarginTop
获取或设置表示顶部边距的值。
public double MarginTop { get; set; }
属性值
double
Class PageSize
继承
object ←
PageSize
派生
继承的成员
构造函数
PageSize()
Documentize.PageSize 的构造函数。默认情况下为 A4 尺寸。
PageSize(double, double)
Documentize.PageSize 的构造函数。
public PageSize(double width, double height)
参数
属性
A0
A0 尺寸 (1189x840 mm)。
public static PageSize A0 { get; }
属性值
PageSize
A1
A1 尺寸 (840x594 mm)。
public static PageSize A1 { get; }
属性值
PageSize
A2
A2 尺寸 (594x420 mm)。
public static PageSize A2 { get; }
属性值
PageSize
A3
A3 尺寸 (420x297 mm)。
public static PageSize A3 { get; }
属性值
PageSize
A4
A4 尺寸 (297x210 mm)。
public static PageSize A4 { get; }
属性值
PageSize
A5
A5 尺寸 (210x148 mm)。
public static PageSize A5 { get; }
属性值
PageSize
A6
A6 尺寸 (148x105 mm)。
public static PageSize A6 { get; }
属性值
PageSize
B5
B5 尺寸 (250x176 mm)。
public static PageSize B5 { get; }
属性值
PageSize
Height
获取或设置页面高度。
public double Height { get; set; }
属性值
double
IsLandscape
获取页面方向。如果是横向方向返回 true,如果是纵向方向返回 false。
public bool IsLandscape { get; }
属性值
bool
P11x17
11x17 英寸格式。
public static PageSize P11x17 { get; }
属性值
PageSize
PageLedger
账本尺寸 (432x279 mm)。
public static PageSize PageLedger { get; }
属性值
PageSize
PageLegal
法律尺寸 (356x216 mm)。
public static PageSize PageLegal { get; }
属性值
PageSize
PageLetter
信纸尺寸 (279x216 mm)。
public static PageSize PageLetter { get; }
属性值
PageSize
Width
获取或设置页面宽度。
public double Width { get; set; }
属性值
double
Class PdfAConverter
信息
表示一个处理PDF文档转换为PDF/A格式以及验证PDF/A符合性的插件。
[Obsolete("该类将很快被删除。请使用PdfConverter类。")]
public static class PdfAConverter
继承
object ←
PdfAConverter
继承成员
方法
Process(PdfToPdfAOptions)
将PDF文档转换为PDF/A格式。
public static ResultContainer Process(PdfToPdfAOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Process(PdfAValidateOptions)
检查PDF文档是否符合指定的PDF/A格式。
public static ResultContainer Process(PdfAValidateOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class PdfAConvertOptions
信息
表示将PDF文档转换为PDF/A格式的选项,使用Documentize.PdfAConverter插件。
public sealed class PdfAConvertOptions : PdfAOptionsBase, IPluginOptions
继承
object ←
PdfAOptionsBase ←
PdfAConvertOptions
实现
继承的成员
- PdfAOptionsBase.AddInput(IDataSource),
- PdfAOptionsBase.Inputs,
- PdfAOptionsBase.PdfAVersion,
- PdfAOptionsBase.IsLowMemoryMode,
- PdfAOptionsBase.LogOutputSource,
- PdfAOptionsBase.ErrorAction,
- PdfAOptionsBase.SoftMaskAction,
- PdfAOptionsBase.CheckDifferentNamesInFontDictionaries,
- PdfAOptionsBase.AlignText,
- PdfAOptionsBase.OptimizeFileSize,
- PdfAOptionsBase.IccProfileFileName,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfAConvertOptions()
public PdfAConvertOptions()
属性
Outputs
获取添加的目标(文件或流数据源)集合,以保存操作结果。
public List<idatasource> Outputs { get; }
属性值
List<IDataSource>
方法
AddOutput(IDataSource)
添加新的结果保存目标。
public void AddOutput(IDataSource dataSource)
参数
Class PdfAOptionsBase
信息
表示 Documentize.PdfAConverter 插件选项的基类。此类提供用于配置 PDF/A 转换和验证过程的属性和方法。
表示 Documentize.PdfAConverter 插件选项的基类。
此类提供用于配置 PDF/A 转换和验证过程的属性和方法。
public abstract class PdfAOptionsBase : IPluginOptions
继承
object ←
PdfAOptionsBase
派生
实现
继承成员
构造函数
PdfAOptionsBase()
protected PdfAOptionsBase()
属性
AlignText
获取或设置一个值,指示在 PDF/A 转换过程中是否需要额外的手段来保持文本对齐。
public bool AlignText { get; set; }
属性值
bool
备注
当设置为 true 时,转换过程将尝试恢复原始文本段的边界。
对于大多数文档,不需要将此属性从默认 false 值更改,因为在默认转换过程中文本对齐不会改变。
CheckDifferentNamesInFontDictionaries
获取控制 PDF/A 转换的标志,适用于源 PDF 文档与 PDF 规范不对应的情况。
public bool CheckDifferentNamesInFontDictionaries { get; set; }
属性值
bool
ErrorAction
获取或设置无法转换的对象的处理操作。
public ConvertErrorAction ErrorAction { get; set; }
属性值
ConvertErrorAction
IccProfileFileName
获取或设置用于 PDF/A 转换的 ICC(国际颜色协会)配置文件的文件名,替代默认配置文件。
public string IccProfileFileName { get; set; }
属性值
string
获取数据源集合
public List<idatasource> Inputs { get; }
属性值
List<IDataSource>
IsLowMemoryMode
获取或设置一个值,指示在 PDF/A 转换过程中是否启用低内存模式。
public bool IsLowMemoryMode { get; set; }
属性值
bool
LogOutputSource
获取或设置日志输出的数据源。
public IDataSource LogOutputSource { get; set; }
属性值
IDataSource
OptimizeFileSize
获取或设置一个值,指示在 PDF/A 转换过程中是否尝试减少文件大小。
public bool OptimizeFileSize { get; set; }
属性值
bool
备注
当设置为 true 时,转换过程将尝试最小化生成的文件大小。
这可能会影响转换过程的性能。
PdfAVersion
获取或设置用于验证或转换的 PDF/A 标准版本。
public PdfAStandardVersion PdfAVersion { get; set; }
属性值
PdfAStandardVersion
备注
PDF/A 标准版本用于确定 PDF/A 验证和转换的合规级别。
如果版本设置为 Documentize.PdfAStandardVersion.Auto,系统将根据文档元数据自动确定适当的 PDF/A 标准版本进行验证。
对于 PDF/A 转换过程,Documentize.PdfAStandardVersion.Auto 默认为 PDF/A-1b 标准版本。
SoftMaskAction
获取或设置在转换带有软遮罩的图像时采取的操作。
public ConvertSoftMaskAction SoftMaskAction { get; set; }
属性值
ConvertSoftMaskAction
方法
向集合中添加新的数据源
public void AddInput(IDataSource dataSource)
参数
Class PdfAValidateOptions
信息
表示用于验证 PDF 文档 PDF/A 合规性的选项,使用的是 Documentize.PdfConverter 插件。
public sealed class PdfAValidateOptions : PdfAOptionsBase, IPluginOptions
继承
object ←
PdfAOptionsBase ←
PdfAValidateOptions
实现
继承成员
- PdfAOptionsBase.AddInput(IDataSource),
- PdfAOptionsBase.Inputs,
- PdfAOptionsBase.PdfAVersion,
- PdfAOptionsBase.IsLowMemoryMode,
- PdfAOptionsBase.LogOutputSource,
- PdfAOptionsBase.ErrorAction,
- PdfAOptionsBase.SoftMaskAction,
- PdfAOptionsBase.CheckDifferentNamesInFontDictionaries,
- PdfAOptionsBase.AlignText,
- PdfAOptionsBase.OptimizeFileSize,
- PdfAOptionsBase.IccProfileFileName,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfAValidateOptions()
public PdfAValidateOptions()
Class PdfAValidationResult
public sealed class PdfAValidationResult
继承
object ←
PdfAValidationResult
继承成员
字段
字段值
IDataSource
IsValid
获取一个值,指示验证是否成功。
public readonly bool IsValid
字段值
bool
StandardVersion
获取用于验证的 PDF/A 标准版本。
public readonly PdfAStandardVersion StandardVersion
字段值
PdfAStandardVersion
Class PdfChatGpt
[Obsolete("该类将很快被删除。请使用 PdfManager 类。")]
public static class PdfChatGpt
继承
object ←
PdfChatGpt
继承的成员
注释
Documentize.PdfChatGpt 用于直接向 ChatGPT 发送请求
或通过添加 PDF 文件源并将回复保存到输出源。
方法
Process(IPluginOptions)
该方法没有同步版本。请改用 ProcessAsync 方法。
public static ResultContainer Process(IPluginOptions options)
参数
返回值
ResultContainer : #### 异常
NotImplementedException
ProcessAsync(IPluginOptions)
使用指定参数启动 PdfChatGpt 处理。
public static Task<resultcontainer> ProcessAsync(IPluginOptions options)
参数
返回值
Task<ResultContainer>
表示异步操作的任务对象。
异常
ArgumentException : InvalidOperationException
Class PdfChatGptOptions
信息
表示 Documentize.PdfChatGpt 插件的选项。
public class PdfChatGptOptions : IPluginOptions
继承
object ←
PdfChatGptOptions
派生
实现
继承成员
构造函数
PdfChatGptOptions()
初始化 Documentize.PdfChatGptOptions 对象的新实例。
public PdfChatGptOptions()
属性
public List<idatasource> Inputs { get; }
属性值
List<IDataSource>
输出
public List<idatasource> Outputs { get; }
属性值
List<IDataSource>
方法
向 PdfChatGpt 插件的数据集合中添加新的数据源。
public void AddInput(IDataSource dataSource)
参数
AddOutput(IDataSource)
向 PdfChatGpt 插件的数据集合中添加新的保存数据源。
public void AddOutput(IDataSource saveDataSource)
参数
Class PdfChatGptRequestOptions
信息
表示 Documentize.PdfChatGpt 插件的选项。
public class PdfChatGptRequestOptions : PdfChatGptOptions, IPluginOptions
继承
object ←
PdfChatGptOptions ←
PdfChatGptRequestOptions
实现
继承成员
- PdfChatGptOptions.AddInput(IDataSource),
- PdfChatGptOptions.AddOutput(IDataSource),
- PdfChatGptOptions.Inputs,
- PdfChatGptOptions.Outputs,
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfChatGptRequestOptions()
使用默认选项初始化 Documentize.PdfChatGptRequestOptions 对象的新实例。
public PdfChatGptRequestOptions()
PdfChatGptRequestOptions(string, string, string, string)
使用选项初始化 Documentize.PdfChatGptRequestOptions 对象的新实例。
public PdfChatGptRequestOptions(string apiKey, string model, string apiUrl, string query)
参数
属性
ApiKey
获取或设置用于访问 ChatGPT API 的密钥。
public string ApiKey { get; set; }
属性值
string
ApiUrl
获取或设置 ChatGPT API 的 URL。
public string ApiUrl { get; set; }
属性值
string
CancellationToken
取消令牌。
public CancellationToken CancellationToken { get; set; }
属性值
CancellationToken
MaxTokens
响应中的最大令牌数。默认值为 null,表示无限。
public int? MaxTokens { get; set; }
属性值
int?
Messages
获取或设置 Documentize.Message 对象的集合。
public List<message> Messages { get; set; }
属性值
List<Message>
备注
当向选项添加多个消息时,消息集合中的顺序如下:
- 第一条消息(如果有的话)来自 options.Query,前面是内容为:“You are a helpful assistant.”,角色为“system”的消息。
- 然后(如果有的话)添加来自 options.Messages 集合的消息。
- 最后添加来自文件源的消息(如果有的话),每个文档一个消息对象,角色为“user”。
如果没有提供一条消息,则会抛出 ArgumentException。
Model
设置或获取要使用的模型的 ID。
public string Model { get; set; }
属性值
string
NumberOfChoices
为每个输入消息生成多少个聊天完成选项。
public int NumberOfChoices { get; set; }
属性值
int
Query
获取或设置发送给 ChatGPT 的字符串请求。
如果不为空,这是集合中的第一条消息,
将被发送的请求中。
public string Query { get; set; }
属性值
string
Temperature
使用的采样温度,在 0 到 2 之间。
更高的值,如 0.8,将使输出更随机,
而更低的值,如 0.2,将使其更集中和确定。
默认值为 1。
public double Temperature { get; set; }
属性值
double
Class PdfConverter
信息
表示 Documentize.PdfConverter 插件。用于将 PDF 文档转换为其他格式,如 DOCX/DOC、XLSX/XLS/CSV/XLSM/ODS、HTML、JPEG、PNG、TIFF、PDF/A。还允许您执行 PDF/A 验证和将 HTML 转换为 PDF。
表示 Documentize.PdfConverter 插件。用于将 PDF 文档转换为其他格式,如 DOCX/DOC、XLSX/XLS/CSV/XLSM/ODS、HTML、JPEG、PNG、TIFF、PDF/A。
还允许您执行 PDF/A 验证和将 HTML 转换为 PDF。
public static class PdfConverter
继承
object ←
PdfConverter
继承成员
示例
该示例演示如何将 PDF 文档转换为 Doc 格式。
// 创建 PdfToDocOptions 对象以设置指令
var options = new PdfToDocOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_file.doc"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为带模式设置的 Doc 格式。
// 创建 PdfToDocOptions 对象以设置指令
var options = new PdfToDocOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_file.doc"));
// 设置模式
options.Mode = DocConversionMode.Flow;
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 转换为 XLSX 文档。
// 创建 PdfToXlsOptions 对象以设置指令
var options = new PdfToXlsOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xlsx"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 转换为 XLS 文档。
// 创建 PdfToXlsOptions 对象以设置指令
var options = new PdfToXlsOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 指定 XLS 格式
options.Format = PdfToXlsOptions.ExcelFormat.XMLSpreadSheet2003;
options.InsertBlankColumnAtFirst = true;
options.MinimizeTheNumberOfWorksheets = true;
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xls"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 转换为 HTML 文档。
// 创建 PdfToHtmlOptions 对象以将输出数据类型设置为带嵌入资源的文件
var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_output.html"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 HTML 转换为 PDF 文档。
// 创建 HtmlToPdfOptions
var options = new HtmlToPdfOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.html"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_output.pdf"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 JPEG 格式。
// 创建 PdfToJpegOptions 对象以设置指令
var options = new PdfToJpegOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 JPEG 格式,并设置页面、分辨率、质量。
// 创建 PdfToJpegOptions 对象以设置指令
var options = new PdfToJpegOptions();
// 仅处理第一页
options.PageList = [1];
// 设置输出分辨率为 200 DPI
options.OutputResolution = 200;
// 设置输出质量为 50
options.Quality = 50;
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 JPEG 格式并输出到流。
// 创建 PdfToJpegOptions 对象以设置指令
var options = new PdfToJpegOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 执行该过程
var results = PdfConverter.Convert(options);
// 获取流结果
foreach (var result in results.ResultCollection)
{
var streamResultPage1 = result.ToStream();
}
该示例演示如何将 PDF 文档转换为 PNG 格式。
// 创建 PdfToPngOptions 对象以设置指令
var options = new PdfToPngOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档的 1 页转换为 PNG 格式。
// 创建 PdfToPngOptions 对象以设置指令
var options = new PdfToPngOptions()
// 仅处理第一页
options.PageList = [1];
// 设置输出分辨率为 200 DPI
options.OutputResolution = 200;
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 PNG 格式并输出到流。
// 创建 PdfToJpegOptions 对象以设置指令
var options = new PdfToPngOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 执行该过程
var results = PdfConverter.Convert(options);
// 获取流结果
foreach (var result in results.ResultCollection)
{
var streamResultPage1 = result.ToStream();
}
该示例演示如何将 PDF 文档转换为 TIFF 格式。
// 创建 PdfToTiffOptions 对象以设置指令
var options = new PdfToTiffOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 TIFF 格式,并自定义页面和 DPI。
// 创建 PdfToTiffOptions 对象以设置指令
var options = new PdfToTiffOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 设置页面
options.PageList = [1, 3];
// 设置结果图像分辨率
options.OutputResolution = 400;
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为多页 TIFF 格式。
// 创建 PdfToTiffOptions 对象以设置指令
var options = new PdfToTiffOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 启用多页 TIFF 输出
options.MultiPage = true;
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 TIFF 格式,并自定义压缩和颜色深度。
// 创建 PdfToTiffOptions 对象以设置指令
var options = new PdfToTiffOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// 设置压缩和颜色深度
options.Compression = TiffCompression.RLE;
options.ColorDepth = TiffColorDepth.Format24bpp;
// 执行该过程
PdfConverter.Convert(options);
该示例演示如何将 PDF 文档转换为 TIFF 格式并输出到流。
// 创建 PdfToTiffOptions 对象以设置指令
var options = new PdfToTiffOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 执行该过程
var results = PdfConverter.Convert(options);
// 获取流结果
foreach (var result in results.ResultCollection)
{
var streamResultPage1 = result.ToStream();
}
该示例演示如何将 PDF 文档转换为 PDF/A 格式(在此案例中为 PDF/A-3b):
// 创建选项类以设置转换过程
var options = new PdfToPdfAOptions
{
PdfAVersion = PdfAStandardVersion.PDF_A_3B
};
// 添加源文件
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf")); // 用您的实际文件路径替换
// 添加转换后文件的保存路径
options.AddOutput(new FileDataSource("path_to_the_converted_file.pdf"));
// 运行转换
PdfConverter.Convert(options);
该示例演示如何验证 PDF 文档是否符合 PDF/A 格式(在此案例中为 PDF/A-1a):
// 创建选项类以设置验证过程
var options = new PdfAValidateOptions
{
PdfAVersion = PdfAStandardVersion.PDF_A_1A
};
// 添加一个或多个文件进行验证
options.AddInput(new FileDataSource("path_to_your_first_pdf_file.pdf")); // 用您的实际文件路径替换
options.AddInput(new FileDataSource("path_to_your_second_pdf_file.pdf"));
// 根据需要添加更多文件
// 运行验证并获取结果
var resultContainer = PdfConverter.Validate(options);
// 检查 resultContainer.ResultCollection 属性以获取每个文件的验证结果:
for (var i = 0; i < resultContainer.ResultCollection.Count; i++)
{
var result = resultContainer.ResultCollection[i];
var validationResult = (PdfAValidationResult) result.Data;
var isValid = validationResult.IsValid; // 第 i 个文档的验证结果
}
方法
Convert(PdfToDocOptions)
将 PDF 文档转换为 DOC/DOCX 格式。
public static ResultContainer Convert(PdfToDocOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(PdfToXlsOptions)
将 PDF 文档转换为 XLSX/XLS/CSV/XLSM/ODS 格式。
public static ResultContainer Convert(PdfToXlsOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(PdfToHtmlOptions)
将 PDF 文档转换为 HTML 格式。
public static ResultContainer Convert(PdfToHtmlOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(HtmlToPdfOptions)
将 HTML 文档转换为 PDF 格式。
public static ResultContainer Convert(HtmlToPdfOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(PdfToJpegOptions)
将 PDF 文档转换为 JPEG 格式。
public static ResultContainer Convert(PdfToJpegOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(PdfToPngOptions)
将 PDF 文档转换为 PNG 格式。
public static ResultContainer Convert(PdfToPngOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(PdfToTiffOptions)
将 PDF 文档转换为 TIFF 格式。
public static ResultContainer Convert(PdfToTiffOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Convert(PdfToPdfAOptions)
将 PDF 文档转换为 PDF/A 格式。
public static ResultContainer Convert(PdfToPdfAOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Validate(PdfAValidateOptions)
检查 PDF 文档是否符合指定的 PDF/A 格式。
public static ResultContainer Validate(PdfAValidateOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class PdfConverterOptions
public abstract class PdfConverterOptions : IPluginOptions
继承
object ←
PdfConverterOptions
派生
实现
继承的成员
属性
返回 PdfConverterOptions 插件数据集合。
public List<idatasource> Inputs { get; }
属性值
List<IDataSource>
输出
获取用于保存操作结果的添加目标集合。
public List<idatasource> Outputs { get; }
属性值
List<IDataSource>
方法
向 PdfConverter 插件数据集合添加新的数据源。
public void AddInput(IDataSource dataSource)
参数
AddOutput(IDataSource)
向 PdfToXLSXConverterOptions 插件数据集合添加新的数据源。
public void AddOutput(IDataSource saveDataSource)
参数
异常
NotImplementedException
信息
表示 Documentize.PdfExtractor 插件。用于从 PDF 文档中提取文本、图像、表单数据。
public static class PdfExtractor
继承
object ←
PdfExtractor
继承成员
示例
此示例演示如何提取 PDF 文档的文本内容。
// 创建 ExtractTextOptions 对象以设置指令
var options = new ExtractTextOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 执行处理
var results = PdfExtractor.ExtractText(options);
// 从 ResultContainer 对象中获取提取的文本
var textExtracted = results.ResultCollection[0].ToString();
此示例演示如何使用 TextFormattingMode 提取 PDF 文档的文本内容。
// 创建 ExtractTextOptions 对象以设置 TextFormattingMode
var options = new ExtractTextOptions(TextFormattingMode.Pure);
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 执行处理
var results = PdfExtractor.ExtractText(options);
// 从 ResultContainer 对象中获取提取的文本
var textExtracted = results.ResultCollection[0].ToString();
此示例演示如何从 PDF 文档中提取图像。
// 创建 ExtractImagesOptions 以设置指令
var options = new ExtractImagesOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出目录路径
options.AddOutput(new DirectoryDataSource("path_to_results_directory"));
// 执行处理
var results = PdfExtractor.ExtractImages(options);
// 获取图像结果的路径
var imageExtracted = results.ResultCollection[0].ToFile();
此示例演示如何将 PDF 文档中的图像提取到流而不使用文件夹。
// 创建 ExtractImagesOptions 以设置指令
var options = new ExtractImagesOptions();
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 不设置输出 - 将结果写入流
// 执行处理
var results = PdfExtractor.ExtractImages(options);
// 获取流
var ms = results.ResultCollection[0].ToStream();
// 为演示复制数据到文件
ms.Seek(0, SeekOrigin.Begin);
using (var fs = File.Create("test_file.png"))
{
ms.CopyTo(fs);
}
此示例演示如何将表单值导出到 CSV 文件。
// 创建 ExtractFormDataToDsvOptions 对象以设置指令
var options = new ExtractFormDataToDsvOptions(',', true);
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_csv_file.csv"));
// 执行处理
PdfExtractor.ExtractFormData(options);
方法
从 PDF 文档中提取表单数据。
public static ResultContainer ExtractFormData(ExtractFormDataToDsvOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
从 PDF 文档中提取图像。
public static ResultContainer ExtractImages(ExtractImagesOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
从 PDF 文档中提取文本。
public static ResultContainer ExtractText(ExtractTextOptions options)
参数
返回
ResultContainer : 包含提取结果的对象。
异常
ArgumentException
如果未设置选项。
Class PdfManager
信息
Represents Documentize.PdfManager plugin. Used to Merge, Split, Optimize, Rotate, Resize, Compress PDF documents and Add Table, Add TOC to PDF documents. Can Merge multiple PDF documents into a single PDF. Can Split PDF documents into separate pages. Can Optimize, Rotate, Resize, Compress PDF documents. Can Rotate, Resize Pages of PDF document. Can Add a Table to a PDF document. Can Add a Table of Contents to PDF document.
Represents Documentize.PdfManager plugin. Used to Merge, Split, Optimize, Rotate, Resize, Compress PDF documents and Add Table, Add TOC to PDF documents.
Can Merge multiple PDF documents into a single PDF.
Can Split PDF documents into separate pages.
Can Optimize, Rotate, Resize, Compress PDF documents.
Can Rotate, Resize Pages of PDF document.
Can Add a Table to a PDF document.
Can Add a Table of Contents to PDF document.
public static class PdfManager
Inheritance
object ←
PdfManager
Inherited Members
Examples
The example demonstrates how to Merge two PDF documents.
// Create MergeOptions object to set instructions
var options = new MergeOptions();
// Add input file paths
options.AddInput(new FileDataSource("path_to_your_pdf_file_1.pdf"));
options.AddInput(new FileDataSource("path_to_your_pdf_file_2.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Merge(options);
The example demonstrates how to Split PDF document.
// Create SplitOptions object to set instructions
var options = new SplitOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file paths
options.AddOutput(new FileDataSource("path_to_result_pdf_file_1.pdf"));
options.AddOutput(new FileDataSource("path_to_result_pdf_file_2.pdf"));
// Perform the process
PdfManager.Split(options);
The example demonstrates how to Optimize PDF document.
// Create OptimizeOptions object to set instructions
var options = new OptimizeOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Optimize(options);
The example demonstrates how to Rotate PDF document.
// Create RotateOptions object to set instructions
var options = new RotateOptions();
// Set new Rotation
options.Rotation = Rotation.On90;
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Rotate(options);
The example demonstrates how to Resize PDF document.
// Create ResizeOptions object to set instructions
var options = new ResizeOptions();
// Set new PageSize
options.PageSize = PageSize.A3;
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Resize(options);
The example demonstrates how to Compress PDF document.
// Create CompressOptions object to set instructions
var options = new CompressOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Compress(options);
The example demonstrates how to Add Table to PDF file.
// Configure table options
var options = new TableOptions();
options.InsertPageBefore(1)
.AddTable()
.AddRow()
.AddCell().AddParagraph("Name")
.AddCell().AddParagraph("Age")
.AddRow()
.AddCell().AddParagraph("Bob")
.AddCell().AddParagraph("12")
.AddRow()
.AddCell().AddParagraph("Sam")
.AddCell().AddParagraph("20")
.AddRow()
.AddCell().AddParagraph("Sandy")
.AddCell().AddParagraph("26")
.AddRow()
.AddCell().AddParagraph("Tom")
.AddCell().AddParagraph("12")
.AddRow()
.AddCell().AddParagraph("Jim")
.AddCell().AddParagraph("27");
// Add input file path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.pdf"));
// Perform the process
PdfManager.AddTable(options);
The example demonstrates how to add Table of Contents to PDF file.
// Create TocOptions object to set instructions
var options = new TocOptions();
// Set the Title
options.Title = "My Table of Contents";
// Design Headings
options.Headings.Add(new TocHeading("Introduction", 2));
options.Headings.Add(new TocHeading("Chapter I", 3));
options.Headings.Add(new TocHeading("Chapter II", 4));
options.Headings.Add(new TocHeading("Chapter III", 5));
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.AddTableOfContents(options);
The example demonstrates how to add Table of Contents to PDF file with generating bookmarks.
// Create TocOptions object to set instructions
var options = new TocOptions();
// Set the Title
options.Title = "My Table of Contents";
// Generate links in bookmarks
options.GenerateBookmarks = true;
// Design Headings
options.Headings.Add(new TocHeading("Introduction", 2, false, 1));
options.Headings.Add(new TocHeading("Chapter I", 3, true, 1));
options.Headings.Add(new TocHeading("Chapter II", 4, true, 1));
options.Headings.Add(new TocHeading("Example A", 4, true, 2));
options.Headings.Add(new TocHeading("Example B", 4, true, 2));
options.Headings.Add(new TocHeading("Example C", 4, true, 2));
options.Headings.Add(new TocHeading("Example D", 4, true, 2));
options.Headings.Add(new TocHeading("Chapter III", 5, true, 1));
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.AddTableOfContents(options);
The example demonstrates how to add Table of Contents to PDF file and save as stream.
// Create TocOptions object to set instructions
var options = new TocOptions();
// Set the Title
options.Title = "My Table of Contents";
// Design Headings
options.Headings.Add(new TocHeading("Introduction", 2, false, 1));
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output stream
var outputStream = new MemoryStream();
options.AddOutput(new StreamDataSource(outputStream));
options.CloseOutputStreams = false;
// Perform the process
PdfManager.AddTableOfContents(options);
The example demonstrates how to use ChatGpt by adding messages to the request.
var options = new ChatGptRequestOptions();
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request messages.
options.Messages.Add(new Message
{
Content = "You are a helpful assistant.",
Role = Role.System
});
options.Messages.Add(new Message
{
Content = "What is the biggest pizza diameter ever made?",
Role = Role.User
});
// Process the request.
var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
The example demonstrates how to use ChatGpt by adding one message to the request.
var options = new ChatGptRequestOptions();
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf")); // Add the output file path.
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request message.
// In this case, the system message with Content = "You are a helpful assistant." is added by default.
// The role of the query message is "user" by default.
options.Query = "What is the lowest temperature recorded on the Earth?";
// Process the request.
var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
The example demonstrates how to use Chat by adding file(s) as the message source(s).
var options = new ChatGptRequestOptions();
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Add the PDF text source.
// In case of multiple sources, the text from each document will be added to the request message collection
// as a separate message with the role "user".
options.AddInput(new FileDataSource("TextSource.pdf"));
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request message.
// In this case, the system message with Content = "You are a helpful assistant." is added by default.
// The role of the query message is "user" by default.
options.Query = "How many letters in the provided text?";
// Process the request.
var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.
Methods
AddTable(TableOptions)
Add Table to PDF document.
public static ResultContainer AddTable(TableOptions options)
Parameters
options TableOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
AddTableOfContents(TocOptions)
Add Table of Contents (TOC) to PDF document.
public static ResultContainer AddTableOfContents(TocOptions options)
Parameters
options TocOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
Compress(CompressOptions)
Compress PDF document. Try to reduce size of the document.
public static ResultContainer Compress(CompressOptions options)
Parameters
options CompressOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
CreatePdfByChatGptRequestAsync(ChatGptRequestOptions)
Create PDF document by Reply of ChatGpt.
Used to send requests to ChatGPT directly or by adding PDF file sources and save the reply to the output source.
public static Task<resultcontainer> CreatePdfByChatGptRequestAsync(ChatGptRequestOptions options)
Parameters
Returns
Task<ResultContainer>
An object containing the result of the operation.
Exceptions
ArgumentException : If options not set.
Merge(MergeOptions)
Merge PDF documents.
public static ResultContainer Merge(MergeOptions options)
Parameters
options MergeOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
Optimize(OptimizeOptions)
Optimize PDF document.
Linearize the document in order to
- open the first page as quickly as possible;
- display next page or follow by link to the next page as quickly as possible;
- display the page incrementally as it arrives when data for a page is delivered over a slow channel (display the most useful data first);
- permit user interaction, such as following a link, to be performed even before the entire page has been received and displayed.
public static ResultContainer Optimize(OptimizeOptions options)
Parameters
options OptimizeOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
Resize(ResizeOptions)
Resize Pages of PDF document.
public static ResultContainer Resize(ResizeOptions options)
Parameters
options ResizeOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
Rotate(RotateOptions)
Rotate Pages of PDF document.
public static ResultContainer Rotate(RotateOptions options)
Parameters
options RotateOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
Split(SplitOptions)
Split PDF document by pages.
public static ResultContainer Split(SplitOptions options)
Parameters
options SplitOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
ArgumentException
If options not set.
Class PdfSecurity
信息
表示 Documentize.PdfSecurity 插件。用于加密、解密和签署 PDF 文档。
public static class PdfSecurity
继承
object ←
PdfSecurity
继承的成员
方法
Decrypt(DecryptOptions)
解密 PDF 文档。
public static ResultContainer Decrypt(DecryptOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
示例
该示例演示如何解密 PDF 文档。
// 创建 DecryptOptions 对象以设置指令
var options = new DecryptOptions("123456");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
PdfSecurity.Decrypt(options);
异常
ArgumentException
如果未设置选项。
Encrypt(EncryptOptions)
加密 PDF 文档。
public static ResultContainer Encrypt(EncryptOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
示例
该示例演示如何加密 PDF 文档。
// 创建 EncryptOptions 对象以设置指令
var options = new EncryptOptions("123456", "qwerty");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
PdfSecurity.Encrypt(options);
异常
ArgumentException
如果未设置选项。
Sign(SignOptions)
通过数字签名签署 PDF 文档。
public static ResultContainer Sign(SignOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
示例
该示例演示如何签署 PDF 文档。
// 创建 SignOptions 对象以设置指令
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
PdfSecurity.Sign(options);
该示例演示如何使用 PFX 文件的流签署 PDF 文档。
using var pfxStream = File.OpenRead(@"path_to_your_pfx_file.pfx");
var options = new SignOptions(pfxStream, "password_of_your_pfx_file");
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
PdfSecurity.Sign(options);
该示例演示如何使用不可见的签名签署 PDF 文档。
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 配置不可见签名
signOptions.Visible = false;
// 执行处理
PdfSecurity.Sign(options);
该示例演示如何使用额外选项签署 PDF 文档。
// 创建 SignOptions 对象以设置指令
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 可选参数
options.Reason = "my Reason";
options.Contact = "my Contact";
options.Location = "my Location";
options.PageNumber = 3;
// 执行处理
PdfSecurity.Sign(options);
该示例演示如何使用时间戳签署 PDF 文档。
// 创建 SignOptions 对象以设置指令
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_for_your_pfx_file");
options.TimestampOptions = new TimestampOptions("server_url");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
PdfSecurity.Sign(options);
异常
ArgumentException
如果未设置选项。
Class PdfToDocOptions
信息
表示 Documentize.PdfConverter 插件的 PDF 到 DOC 转换器选项。
public sealed class PdfToDocOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
PdfToDocOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToDocOptions()
使用默认选项初始化 Documentize.PdfToDocOptions 对象的新实例。
属性
Mode
允许控制如何将 PDF 文档转换为文档处理文档。
public DocConversionMode Mode { get; set; }
属性值
DocConversionMode
备注
当生成的文档不需要进一步重大编辑时,使用 Documentize.DocConversionMode.TextBox 模式。
文本框在修改时比较容易,尤其是在需要做的事情不多的情况下。
当输出文档需要进一步修改时,使用 Documentize.DocConversionMode.Flow 模式。
流模式中的段落和文本行允许轻松修改文本,但不支持的格式对象的显示效果会比
Documentize.DocConversionMode.TextBox 模式差。
Class PdfToHtmlOptions
信息
表示 Documentize.PdfConverter 插件的 PDF 到 HTML 转换器选项。
public sealed class PdfToHtmlOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
PdfToHtmlOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToHtmlOptions(SaveDataType)
初始化 Documentize.PdfToHtmlOptions 对象的新实例,以指定的输出数据类型。
public PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType outputDataType = SaveDataType.FileWithExternalResources)
参数
属性
OutputDataType
获取输出数据类型。
public PdfToHtmlOptions.SaveDataType OutputDataType { get; }
属性值
PdfToHtmlOptions.SaveDataType
Class PdfToJpegOptions
信息
表示 Documentize.PdfConverter 插件的 PDF 到 JPEG 转换器选项。
public sealed class PdfToJpegOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
PdfToJpegOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToJpegOptions()
初始化 Documentize.PdfToJpegOptions 对象的新实例。
public PdfToJpegOptions()
属性
OutputResolution
获取或设置生成的图像的分辨率值。
public int OutputResolution { get; set; }
属性值
int
PageList
获取或设置用于处理的页面列表。
public List<int> PageList { get; set; }
属性值
List<int>
Quality
获取和设置输出质量。
指定图像的压缩级别。
质量的有效值范围是从 0 到 100。
指定的数字越低,压缩越高,因此图像的质量越低。
零将给您最低质量的图像,而 100 将给您最高质量。
public int Quality { get; set; }
属性值
int
Class PdfToPdfAOptions
信息
表示将PDF文档转换为PDF/A格式的选项,使用Documentize.PdfConverter插件。
public sealed class PdfToPdfAOptions : PdfAOptionsBase, IPluginOptions
继承
object ←
PdfAOptionsBase ←
PdfToPdfAOptions
实现
继承成员
- PdfAOptionsBase.AddInput(IDataSource),
- PdfAOptionsBase.Inputs,
- PdfAOptionsBase.PdfAVersion,
- PdfAOptionsBase.IsLowMemoryMode,
- PdfAOptionsBase.LogOutputSource,
- PdfAOptionsBase.ErrorAction,
- PdfAOptionsBase.SoftMaskAction,
- PdfAOptionsBase.CheckDifferentNamesInFontDictionaries,
- PdfAOptionsBase.AlignText,
- PdfAOptionsBase.OptimizeFileSize,
- PdfAOptionsBase.IccProfileFileName,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToPdfAOptions()
public PdfToPdfAOptions()
属性
Outputs
获取已添加的目标(文件或流数据源)集合,以保存操作结果。
public List<idatasource> Outputs { get; }
属性值
List<IDataSource>
方法
AddOutput(IDataSource)
添加新的结果保存目标。
public void AddOutput(IDataSource dataSource)
参数
Class PdfToPngOptions
信息
表示 Documentize.PdfConverter 插件的 PDF 到 PNG 转换器选项。
public sealed class PdfToPngOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
PdfToPngOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToPngOptions()
初始化 Documentize.PdfToPngOptions 对象的新实例。
属性
OutputResolution
获取或设置生成图像的分辨率值。
public int OutputResolution { get; set; }
属性值
int
PageList
获取或设置处理页面的列表。
public List<int> PageList { get; set; }
属性值
List<int>
Class PdfToTiffOptions
信息
代表 Documentize.PdfConverter 插件的 PDF 到 TIFF 转换器选项。
public sealed class PdfToTiffOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
PdfToTiffOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToTiffOptions()
初始化 Documentize.PdfToTiffOptions 对象的新实例。
public PdfToTiffOptions()
属性
ColorDepth
获取或设置颜色深度。
public TiffColorDepth ColorDepth { get; set; }
属性值
TiffColorDepth
备注
默认值为 Documentize.TiffColorDepth.Format32bpp。
Compression
获取或设置压缩类型。
public TiffCompression Compression { get; set; }
属性值
TiffCompression
备注
默认值为 Documentize.TiffCompression.LZW。
MultiPage
获取和设置允许将所有页面保存为一个多页 TIFF 的标志。
默认值为 false。
public bool MultiPage { get; set; }
属性值
bool
OutputResolution
获取或设置生成图像的分辨率值。
public int OutputResolution { get; set; }
属性值
int
PageList
获取或设置处理的页面列表。
public List<int> PageList { get; set; }
属性值
List<int>
Class PdfToXlsOptions
信息
表示 Documentize.PdfConverter 插件的 PDF 到 XLS/XLSX 转换器选项。
public sealed class PdfToXlsOptions : PdfConverterOptions, IPluginOptions
继承
object ←
PdfConverterOptions ←
PdfToXlsOptions
实现
继承成员
- PdfConverterOptions.AddInput(IDataSource),
- PdfConverterOptions.AddOutput(IDataSource),
- PdfConverterOptions.Inputs,
- PdfConverterOptions.Outputs,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
PdfToXlsOptions()
使用默认选项初始化 Documentize.PdfToXlsOptions 对象的新实例。
属性
输出格式。
public PdfToXlsOptions.ExcelFormat Format { get; set; }
属性值
PdfToXlsOptions.ExcelFormat
InsertBlankColumnAtFirst
如果需要将空白列插入为工作表的第一列,则设置为 true。
默认值为 false;这意味着不会插入空白列。
public bool InsertBlankColumnAtFirst { get; set; }
属性值
bool
MinimizeTheNumberOfWorksheets
如果需要最小化结果工作簿中的工作表数量,则设置为 true。
默认值为 false;这意味着每个 PDF 页面将另存为单独的工作表。
public bool MinimizeTheNumberOfWorksheets { get; set; }
属性值
bool
Class PluginBaseOptions
public class PluginBaseOptions : IPluginOptions
继承
object ←
PluginBaseOptions
派生
- AddTimestampOptions,
- ChatGptRequestOptions,
- CompressOptions,
- DecryptOptions,
- EncryptOptions,
- ExtractFormDataToDsvOptions,
- ExtractImagesOptions,
- FormFlattenerOptions,
- HtmlToPdfOptions,
- MergeOptions,
- OptimizeOptions,
- PdfToDocOptions,
- PdfToHtmlOptions,
- PdfToJpegOptions,
- PdfToPngOptions,
- PdfToTiffOptions,
- ResizeOptions,
- RotateOptions,
- SignOptions,
- SplitOptions,
- TableOptions,
- TocOptions
实现
继承成员
属性
操作完成后关闭输入流。
public bool CloseInputStreams { get; set; }
属性值
bool
CloseOutputStreams
操作完成后关闭输出流。
public bool CloseOutputStreams { get; set; }
属性值
bool
返回操作所需的输入数据。
public List<idatasource> Inputs { get; }
属性值
List<IDataSource>
Outputs
返回操作所需的输出数据。
public List<idatasource> Outputs { get; }
属性值
List<IDataSource>
方法
将新数据添加到输入中。
public void AddInput(IDataSource dataSource)
参数
AddOutput(IDataSource)
将新数据添加到输出中。
public void AddOutput(IDataSource saveDataSource)
参数
Class PngConverter
信息
表示 Documentize.PngConverter 插件。用于将 PDF 文档转换为 PNG 格式。
[Obsolete("该类将很快被删除。请使用 PdfConverter 类。")]
public static class PngConverter
继承
object ←
PngConverter
继承的成员
方法
Process(PdfToPngOptions)
将 PDF 文档转换为 PNG 格式。
public static ResultContainer Process(PdfToPngOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class Rectangle
继承
object ←
Rectangle
继承的成员
构造函数
Rectangle(double, double, double, double)
Rectangle 的构造函数。
public Rectangle(double llx, double lly, double urx, double ury)
参数
Class ResizeOptions
信息
表示 Documentize.PdfManager 插件的调整大小选项。
public sealed class ResizeOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
ResizeOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
ResizeOptions()
使用默认选项初始化 Documentize.ResizeOptions 对象的新实例。
属性
PageSize
获取或设置新页面大小。
public PageSize PageSize { get; set; }
属性值
PageSize
Class ResultContainer
public class ResultContainer
继承
object ←
ResultContainer
继承的成员
属性
ResultCollection
获取操作结果的集合
public List<ioperationresult> ResultCollection { get; }
属性值
List<IOperationResult>
Class RotateOptions
信息
表示 Documentize.PdfManager 插件的旋转选项。
public sealed class RotateOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
RotateOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
RotateOptions()
用默认选项初始化 Documentize.RotateOptions 对象的新实例。
属性
Rotation
获取或设置新页面的旋转。
public Rotation Rotation { get; set; }
属性值
Rotation
Class Signature
信息
表示 Documentize.Signature 插件。用于签署 PDF 文档。
[Obsolete("该类将很快被删除。请使用 PdfSecurity 类。")]
public static class Signature
继承
object ←
Signature
继承的成员
方法
Process(SignOptions)
签署 PDF 文档。
public static ResultContainer Process(SignOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class SignOptions
信息
表示 Documentize.PdfSecurity 插件的签名选项。
public sealed class SignOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
SignOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
SignOptions(string, string)
使用默认选项初始化 Documentize.SignOptions 对象的新实例。
public SignOptions(string pfx, string password)
参数
SignOptions(Stream, string)
使用默认选项初始化 Documentize.SignOptions 对象的新实例。
public SignOptions(Stream pfx, string password)
参数
属性
签名的联系信息。
public string Contact { get; set; }
属性值
string
Location
签名的位置。
public string Location { get; set; }
属性值
string
Name
现有签名字段的名称。
为 null 则创建新字段。
public string Name { get; set; }
属性值
string
PageNumber
签名所在页码。
public int PageNumber { get; set; }
属性值
int
Reason
签名的原因。
public string Reason { get; set; }
属性值
string
Rectangle
签名的矩形区域。
public Rectangle Rectangle { get; set; }
属性值
Rectangle
TimestampOptions
时间戳选项。
public TimestampOptions TimestampOptions { get; set; }
属性值
TimestampOptions
Visible
签名的可见性。
public bool Visible { get; set; }
属性值
bool
Class SplitOptions
信息
表示 Documentize.PdfManager 插件的拆分选项。
public sealed class SplitOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
SplitOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
SplitOptions()
使用默认选项初始化 Documentize.SplitOptions 对象的新实例。
Class Splitter
信息
代表 Documentize.Splitter 插件。用于将 PDF 文档拆分为单独的页面。
[Obsolete("该类将很快被删除。请使用 PdfManager 类。")]
public static class Splitter
继承关系
object ←
Splitter
继承成员
方法
Process(SplitOptions)
按页面拆分 PDF 文档。
public static ResultContainer Process(SplitOptions options)
参数
返回值
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class StreamDataSource
public sealed class StreamDataSource : IDataSource
继承
object ←
StreamDataSource
实现
继承成员
构造函数
StreamDataSource(Stream)
使用指定的流对象初始化新的流数据源。
public StreamDataSource(Stream data)
参数
属性
Data
获取当前数据源的流对象。
public Stream Data { get; }
属性值
Stream
DataType
数据源类型(流)。
public DataType DataType { get; }
属性值
DataType
Class StreamResult
public sealed class StreamResult : IOperationResult
继承
object ←
StreamResult
实现
继承成员
属性
数据
获取原始数据。
public object Data { get; }
属性值
object
IsFile
指示结果是否为输出文件的路径。
public bool IsFile { get; }
属性值
bool
IsStream
指示结果是否为输出文件的路径。
public bool IsStream { get; }
属性值
bool
IsString
指示结果是否为字符串。
public bool IsString { get; }
属性值
bool
方法
ToFile()
尝试将结果转换为文件。
返回
string : 如果结果是文件,则返回表示输出文件路径的字符串;否则返回 null。
ToStream()
尝试将结果转换为流对象。
返回
Stream : 如果结果是流,则返回表示输出数据的流对象;否则返回 null。
Class StringResult
public sealed class StringResult : IOperationResult
继承
object ←
StringResult
实现
继承成员
属性
Data
获取原始数据。
public object Data { get; }
属性值
object
IsFile
指示结果是否为输出文件的路径。
public bool IsFile { get; }
属性值
bool
IsStream
指示结果是否为输出文件的路径。
public bool IsStream { get; }
属性值
bool
IsString
指示结果是否为字符串。
public bool IsString { get; }
属性值
bool
Text
返回结果的字符串表示。
public string Text { get; }
属性值
string
方法
ToFile()
尝试将结果转换为文件。
返回
string : 如果结果是文件,则返回表示输出文件路径的字符串;否则返回 null。
ToStream()
尝试将结果转换为流对象。
返回
Stream : 如果结果是流,则返回表示输出数据的流对象;否则返回 null。
ToString()
尝试将结果转换为字符串。
public override string ToString()
返回
string : 如果结果是字符串,则返回表示文本内容的字符串;否则返回 base.ToString()。
Class TableBuilder
public class TableBuilder
继承
object ←
TableBuilder
派生
继承成员
方法
AddRow()
向表中添加新行。
public virtual TableRowBuilder AddRow()
返回
TableRowBuilder : 当前 Documentize.TableRowBuilder 的实例。
AddTable()
向文档添加新表。
public TableBuilder AddTable()
返回
TableBuilder : 当前 Documentize.TableBuilder 的实例。
InsertPageAfter(int)
在指定页面之后插入页面。
public TableOptions InsertPageAfter(int page)
参数
返回
TableOptions : 当前 Documentize.TableOptions 的实例。
InsertPageBefore(int)
在指定页面之前插入页面。
public TableOptions InsertPageBefore(int page)
参数
返回
TableOptions : 当前 Documentize.TableOptions 的实例。
操作符
implicit operator TableOptions(TableBuilder)
将构建器 Documentize.TableBuilder 转换为选项 Documentize.TableOptions
public static implicit operator TableOptions(TableBuilder builder)
参数
返回
TableOptions : 转换为 PdfGeneratorTableOptions 的结果。
Class TableCellBuilder
public class TableCellBuilder : TableRowBuilder
继承关系
object ←
TableBuilder ←
TableRowBuilder ←
TableCellBuilder
继承的成员
- TableRowBuilder.AddCell(),
- TableRowBuilder.AddRow(),
- TableBuilder.AddRow(),
- TableBuilder.AddTable(),
- TableBuilder.InsertPageAfter(int),
- TableBuilder.InsertPageBefore(int),
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
方法
AddCell()
添加单元格到表格。
public override TableCellBuilder AddCell()
返回值
TableCellBuilder : 当前 Documentize.TableCellBuilder 的实例。
AddParagraph(params string[])
向表格单元添加段落。
public TableCellBuilder AddParagraph(params string[] paragraphs)
参数
返回值
TableCellBuilder : 当前 Documentize.TableCellBuilder 的实例。
Class TableGenerator
信息
表示 Documentize.TableGenerator 插件。用于向 PDF 文档添加表格。
[Obsolete("该类将很快被删除。请使用 PdfManager 类。")]
public static class TableGenerator
继承
object ←
TableGenerator
继承成员
示例
该示例演示如何向 PDF 文件添加表格。
// 配置表格选项
var options = new TableOptions().InsertPageBefore(1)
.AddTable()
.AddRow()
.AddCell().AddParagraph("姓名")
.AddCell().AddParagraph("年龄")
.AddRow()
.AddCell().AddParagraph("Bob")
.AddCell().AddParagraph("12")
.AddRow()
.AddCell().AddParagraph("Sam")
.AddCell().AddParagraph("20")
.AddRow()
.AddCell().AddParagraph("Sandy")
.AddCell().AddParagraph("26")
.AddRow()
.AddCell().AddParagraph("Tom")
.AddCell().AddParagraph("12")
.AddRow()
.AddCell().AddParagraph("Jim")
.AddCell().AddParagraph("27");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_output.pdf"));
// 执行处理
TableGenerator.Process(options);
方法
Process(TableOptions)
向 PDF 文档添加表格。
public static ResultContainer Process(TableOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class TableOptions
信息
表示通过 Documentize.PdfManager 插件将表添加到文档的选项。
public sealed class TableOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
TableOptions
实现
继承的成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
TableOptions()
初始化一个具有默认选项的 Documentize.TableOptions 对象的新实例。
方法
AddTable()
将表添加到文档。
public TableBuilder AddTable()
返回
TableBuilder : Documentize.TableBuilder 的新实例。
Create()
创建 Documentize.TableOptions 的实例。
public static TableOptions Create()
返回
TableOptions : Documentize.TableOptions 的新实例。
InsertPageAfter(int)
在指定页面之后插入页面。
public TableOptions InsertPageAfter(int page)
参数
返回
TableOptions : 当前 Documentize.TableOptions 的实例。
InsertPageBefore(int)
在指定页面之前插入页面。
public TableOptions InsertPageBefore(int page)
参数
返回
TableOptions : 当前 Documentize.TableOptions 的实例。
Class TableRowBuilder
public class TableRowBuilder : TableBuilder
继承
object ←
TableBuilder ←
TableRowBuilder
派生
继承成员
- TableBuilder.AddRow(),
- TableBuilder.AddTable(),
- TableBuilder.InsertPageAfter(int),
- TableBuilder.InsertPageBefore(int),
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
方法
AddCell()
向表格行添加单元格。
public virtual TableCellBuilder AddCell()
返回
TableCellBuilder : 创建的 Documentize.TableCellBuilder 的实例。
AddRow()
覆盖 AddRow。
public override TableRowBuilder AddRow()
返回
TableRowBuilder : 当前 Documentize.TableRowBuilder 的实例。
信息
表示 Documentize.TextExtractor 插件。用于从 PDF 文档中提取文本。
[Obsolete("该类将很快被删除。请使用 PdfExtractor 类。")]
public static class TextExtractor
继承关系
object ←
TextExtractor
继承成员
方法
从 PDF 文档中提取文本。
public static ResultContainer Process(ExtractTextOptions options)
参数
返回值
ResultContainer : 一个包含提取结果的对象。
异常
ArgumentException
如果未设置选项。
信息
表示 Documentize.TextExtractor 插件的文本提取选项。
public sealed class TextExtractorOptions
继承
object ←
TextExtractorOptions
继承的成员
构造函数
为指定的文本格式模式初始化 Documentize.TextExtractorOptions 对象的新实例。
public TextExtractorOptions(TextFormattingMode formattingMode = TextFormattingMode.Raw)
参数
属性
获取格式模式。
public TextFormattingMode FormattingMode { get; set; }
属性值
TextFormattingMode
返回操作的输入数据。
public List<idatasource> Inputs { get; }
属性值
List<IDataSource>
方法
向 Inputs 添加新数据。
public void AddInput(IDataSource dataSource)
参数
Class TiffConverter
信息
表示 Documentize.TiffConverter 插件。用于将 PDF 文档转换为 TIFF 格式。
[Obsolete("该类将很快被删除。请使用 PdfConverter 类。")]
public static class TiffConverter
继承
object ←
TiffConverter
继承成员
方法
Process(PdfToTiffOptions)
将 PDF 文档转换为 TIFF 格式。
public static ResultContainer Process(PdfToTiffOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果选项未设置。
Class Timestamp
信息
表示 Documentize.Timestamp 插件。用于向文档添加时间戳。
[Obsolete("该类将很快被删除。请使用 PdfSecurity 类。")]
public static class Timestamp
继承
object ←
Timestamp
继承的成员
方法
Process(AddTimestampOptions)
使用指定的参数启动 Documentize.Timestamp 处理。
public static ResultContainer Process(AddTimestampOptions options)
参数
返回
ResultContainer:包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Class TimestampOptions
public class TimestampOptions
继承
object ←
TimestampOptions
继承的成员
构造函数
TimestampOptions(string, string)
初始化 Documentize.TimestampOptions 类的新实例。
public TimestampOptions(string serverUrl, string basicAuthCredentials = "")
参数
serverUrl string: 时间戳服务器的 URL。basicAuthCredentials string: 基本身份验证凭据,用户名和密码组合成字符串 “username:password”。
属性
BasicAuthCredentials
获取/设置基本身份验证凭据,用户名和密码组合成字符串 “username:password”。
public string BasicAuthCredentials { get; set; }
属性值
string
ServerUrl
获取/设置时间戳服务器的 URL。
public string ServerUrl { get; set; }
属性值
string
Class TocGenerator
信息
表示 Documentize.TocGenerator 插件。用于向 PDF 文档添加目录。
[Obsolete("该类将很快被删除。请使用 PdfManager 类。")]
public static class TocGenerator
继承
object ←
TocGenerator
继承成员
示例
该示例演示如何向 PDF 文件添加目录。
// 创建 TocOptions 对象以设置指令
var options = new TocOptions();
// 设置标题
options.Title = "我的目录";
// 设计标题
options.Headings.Add(new TocHeading("引言", 2));
options.Headings.Add(new TocHeading("第一章", 3));
options.Headings.Add(new TocHeading("第二章", 4));
options.Headings.Add(new TocHeading("第三章", 5));
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
TocGenerator.Process(options);
该示例演示如何向 PDF 文件添加目录并生成书签。
// 创建 TocOptions 对象以设置指令
var options = new TocOptions();
// 设置标题
options.Title = "我的目录";
// 在书签中生成链接
options.GenerateBookmarks = true;
// 设计标题
options.Headings.Add(new TocHeading("引言", 2, false, 1));
options.Headings.Add(new TocHeading("第一章", 3, true, 1));
options.Headings.Add(new TocHeading("第二章", 4, true, 1));
options.Headings.Add(new TocHeading("示例 A", 4, true, 2));
options.Headings.Add(new TocHeading("示例 B", 4, true, 2));
options.Headings.Add(new TocHeading("示例 C", 4, true, 2));
options.Headings.Add(new TocHeading("示例 D", 4, true, 2));
options.Headings.Add(new TocHeading("第三章", 5, true, 1));
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// 执行处理
TocGenerator.Process(options);
该示例演示如何向 PDF 文件添加目录并作为流保存。
// 创建 TocOptions 对象以设置指令
var options = new TocOptions();
// 设置标题
options.Title = "我的目录";
// 设计标题
options.Headings.Add(new TocHeading("引言", 2, false, 1));
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// 设置输出流
var outputStream = new MemoryStream();
options.AddOutput(new StreamDataSource(outputStream));
options.CloseOutputStreams = false;
// 执行处理
TocGenerator.Process(options);
方法
Process(TocOptions)
使用指定参数开始 Documentize.TocGenerator 处理。
public static ResultContainer Process(TocOptions options)
参数
返回
ResultContainer : 一个 Documentize.ResultContainer 对象,包含操作的结果。
Class TocHeading
信息
表示 Documentize.PdfManager 插件在目录中记录标题或标题的选项。
继承
object ←
TocHeading
继承成员
构造函数
TocHeading(string, int, bool, int)
初始化 Documentize.TocHeading 的新实例。
public TocHeading(string text = "", int pageNumber = 1, bool generateNumbering = false, int level = 1)
参数
text string: 标题的文本。pageNumber int: 链接的页码。generateNumbering bool: 使用编号生成。level int: 级别。
属性
GenerateNumbering
使用编号生成。
如果 true,则编号应自动完成;否则,编号应手动完成。
public bool GenerateNumbering { get; set; }
属性值
bool
Level
级别。
用于编号生成。
public int Level { get; set; }
属性值
int
PageNumber
链接的页码。
public int PageNumber { get; set; }
属性值
int
Text
标题的文本。
public string Text { get; set; }
属性值
string
Class TocOptions
信息
表示通过 Documentize.PdfManager 插件将目录添加到文档的选项。
public sealed class TocOptions : PluginBaseOptions, IPluginOptions
继承
object ←
PluginBaseOptions ←
TocOptions
实现
继承成员
- PluginBaseOptions.AddInput(IDataSource),
- PluginBaseOptions.AddOutput(IDataSource),
- PluginBaseOptions.Inputs,
- PluginBaseOptions.Outputs,
- PluginBaseOptions.CloseInputStreams,
- PluginBaseOptions.CloseOutputStreams,
- object.GetType(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
构造函数
TocOptions()
使用默认选项初始化 Documentize.TocOptions 对象的新实例。
属性
GenerateBookmarks
使用书签生成。
如果设置为 true,则书签将被清除并由标题生成;否则,书签不会更改。
public bool GenerateBookmarks { get; set; }
属性值
bool
Headings
目录的标题或标题。
public List<tocheading> Headings { get; set; }
属性值
List<TocHeading>
Title
目录的标题。
public string Title { get; set; }
属性值
string
Class XlsConverter
信息
表示 Documentize.XlsConverter 插件。用于将 PDF 文档转换为 XLSX/XLS/CSV/XLSM/ODS 格式。
[Obsolete("该类将很快被删除。请使用 PdfConverter 类。")]
public static class XlsConverter
继承
object ←
XlsConverter
继承成员
方法
Process(PdfToXlsOptions)
将 PDF 文档转换为 XLSX/XLS/CSV/XLSM/ODS 格式。
public static ResultContainer Process(PdfToXlsOptions options)
参数
返回
ResultContainer : 包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Enum ConvertErrorAction
public enum ConvertErrorAction
字段
Enum ConvertSoftMaskAction
public enum ConvertSoftMaskAction
字段
ConvertToStencilMask = 1: 软遮罩将转换为模板遮罩。Default = 0: 使用默认策略。
Enum DocConversionMode
public enum DocConversionMode
字段
Flow = 1: 完全识别模式,引擎执行分组和多级分析,以恢复原始文档作者的意图,并生成一个可最大程度编辑的文档。缺点是输出文档可能与原始PDF文件看起来不同。TextBox = 0: 该模式快速且在最大程度上保留原始PDF文件的外观,但生成文档的可编辑性可能有限。原始PDF文件中每个视觉上分组的文本块都被转换为生成文档中的文本框。这实现了输出文档与原始PDF文件的最大相似性。输出文档看起来不错,但它完全由文本框组成,这可能使在Microsoft Word中进一步编辑文档变得非常困难。这是默认模式。
public enum HtmlMediaType
字段
Print = 0: 打印。Screen = 1: 屏幕。
Enum HtmlPageLayoutOption
信息
指定标志,这些标志与其他选项共同决定页面的大小和布局。
public enum HtmlPageLayoutOption
字段
FitToWidestContentWidth = 3: 表示页面的宽度由内容大小本身决定,而不是由指定的页面宽度决定。None = 0: 默认值,表示 HtmlPageLayoutOption 不会影响页面的大小和布局。ScaleToPageWidth = 256: 表示文档的内容将被缩放以适应页面。
Enum PdfAStandardVersion
public enum PdfAStandardVersion
字段
Auto = 0: PDF/A标准版本自动确定。PDF_A_1A = 1: 指定PDF/A-1a标准版本。PDF_A_1B = 2: 指定PDF/A-1b标准版本。PDF_A_2A = 3: 指定PDF/A-2a标准版本。PDF_A_2B = 4: 指定PDF/A-2b标准版本。PDF_A_2U = 5: 指定PDF/A-2u标准版本。PDF_A_3A = 6: 指定PDF/A-3a标准版本。PDF_A_3B = 7: 指定PDF/A-3b标准版本。PDF_A_3U = 8: 指定PDF/A-3u标准版本。
Enum PdfToHtmlOptions.SaveDataType
public enum PdfToHtmlOptions.SaveDataType
字段
FileWithEmbeddedResources = 1: 将HTML保存为包含嵌入资源的文件FileWithExternalResources = 0: 将HTML保存为包含外部资源的文件StreamWithEmbeddedResources = 2: 将HTML保存为包含嵌入资源的文件流
信息
允许指定 xls/xlsx/xml/csv 文件格式。默认值为 XLSX。
允许指定 xls/xlsx/xml/csv 文件格式。
默认值为 XLSX。
public enum PdfToXlsOptions.ExcelFormat
字段
CSV = 2: 逗号分隔值 (.csv) 文件格式。ODS = 4: 开放文档电子表格。XLSM = 3: 启用宏的 Office Open XML (.xlsm) 文件格式。XLSX = 1: Office Open XML (.xlsx) 文件格式。XMLSpreadSheet2003 = 0: Excel 2003 XML (.xls) 文件格式。
Enum Role
字段
Assistant = 2System = 1User = 0
Enum Rotation
Fields
None = 0: 未旋转。On180 = 2: 旋转180度。On270 = 3: 顺时针旋转270度。On360 = 4: 顺时针旋转360度。On90 = 1: 顺时针旋转90度。
Enum TextFormattingMode
信息
定义在将 PDF 文档转换为文本时可用的不同模式。请参见 Documentize.ExtractTextOptions 类。
public enum TextFormattingMode
Fields
Flatten = 2: 通过坐标定位文本片段来表示 PDF 内容。基本上类似于“Raw”模式。但是,“Raw”关注于保留文档中文本片段(操作符)的结构,而“Flatten”则关注于保持文本按照阅读顺序排列。Pure = 0: 通过一些格式化例程来表示 PDF 文本内容。这包括考虑相对位置并添加额外的空格以将文本对齐到页面的宽度。Raw = 1: 按原样表示 PDF 内容,即不进行格式化。
Enum TiffColorDepth
信息
用于指定 Documentize.PdfToTiffOptions 的颜色深度。
public enum TiffColorDepth
字段
Format1bpp = 4: 每像素1位。Format24bpp = 1: 每像素24位。Rgb。Format32bpp = 0: 每像素32位。默认使用。Format4bpp = 3: 每像素4位。Format8bpp = 2: 每像素8位。
Enum TiffCompression
信息
用于指定 Documentize.PdfToTiffOptions 的压缩类型。
public enum TiffCompression
字段
CCITT3 = 2: 指定 CCITT3 压缩方案。可以作为属于压缩类别的参数传递给 CCITT3 编码器。CCITT4 = 1: 指定 CCITT4 压缩方案。可以作为属于压缩类别的参数传递给 CCITT4 编码器。LZW = 0: 指定 LZW 压缩方案。可以作为属于压缩类别的参数传递给 Tiff 编码器。None = 4: 指定不压缩。可以作为属于压缩类别的参数传递给 Tiff 编码器。RLE = 3: 指定 RLE 压缩方案。可以作为属于压缩类别的参数传递给 RLE 编码器。
Interface IPluginOptions
信息
通用插件选项接口,定义具体插件选项应实现的常用方法。
public interface IPluginOptions
接口 IDataSource
public interface IDataSource
属性
DataType
数据源的类型。
DataType DataType { get; }
属性值
DataType
接口 IOperationResult
信息
通用操作结果接口,定义具体插件操作结果应实现的公共方法。
public interface IOperationResult
属性
Data
获取原始数据。
属性值
object
IsFile
指示结果是否为输出文件的路径。
属性值
bool
IsStream
指示结果是否为输出流。
属性值
bool
IsString
指示结果是否为文本字符串。
属性值
bool
方法
ToFile()
尝试将结果转换为文件。
返回
string : 如果结果是文件,则表示输出文件路径的字符串;否则为 null。
ToStream()
尝试将结果转换为流对象。
返回
Stream : 如果结果是流,则表示输出数据的流对象;否则为 null。
类 Security
信息
表示 Documentize.Security 插件。用于加密和解密 PDF 文档。
[Obsolete("该类将很快被删除。请使用 PdfSecurity 类。")]
public static class Security
继承
object ←
Security
继承成员
方法
Process(EncryptOptions)
加密 PDF 文档。
public static ResultContainer Process(EncryptOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
Process(DecryptOptions)
解密 PDF 文档。
public static ResultContainer Process(DecryptOptions options)
参数
返回
ResultContainer : 一个包含操作结果的对象。
异常
ArgumentException
如果未设置选项。
类信息
继承
object ←
Info
继承成员
字段
字段值
string
产品
产品名称。
public const string Product = "Documentize"
字段值
string
类许可证
public static class License
继承
object ←
License
继承的成员
示例
显示如何激活许可证。
// 设置许可证
License.Set("PathToLicense.lic");
方法
Set(string)
对组件进行许可证授权。
public static void Set(string licenseName)
参数
licenseName string: 可以是完整的或短的文件名。使用空字符串切换到评估模式。
类用法
继承
object ←
Usage
继承成员
构造函数
Usage()
属性
CompletionTokens
生成的完成中的令牌数量。
[JsonProperty("completion_tokens")]
public int CompletionTokens { get; set; }
属性值
int
PromptTokens
提示中的令牌数量。
[JsonProperty("prompt_tokens")]
public int PromptTokens { get; set; }
属性值
int
TotalTokens
请求中使用的令牌总数(提示 + 完成)。
[JsonProperty("total_tokens")]
public int TotalTokens { get; set; }
属性值
int
信息
定义在将 PDF 文档转换为文本时可以使用的不同模式。请参见 Documentize.TextExtractorOptions 类。
public enum TextExtractorOptions.TextFormattingMode
Fields
Plain = 2: 表示 PDF 文本内容,考虑文本片段的相对位置,但不添加额外空格。Pure = 0: 表示带有少量格式化例程的 PDF 文本内容。这包括考虑相对位置并添加额外空格以使文本对齐到页面宽度。Raw = 1: 表示 PDF 内容,原样输出,即不进行格式化。
枚举数据类型
字段
Directory = 2: 数据类型是一个目录,通过其路径表示。File = 0: 数据类型是一个文件,通过其路径表示。Stream = 1: 数据类型是一个流。