Documentation
¶
Overview ¶
Package convert 提供与界面无关的 OFD/PDF 转换及安全输出管理。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Request ¶
type Request struct {
Input string
OutputDir string
RelativeDir string
Password string
LossyImages bool
}
Request 描述一份文件的转换。OutputDir 为空时使用输入目录下的“转换结果”。 RelativeDir 为指定 OutputDir 时保留的相对子目录,必须是本地相对路径。 Password 仅用于打开 PDF,不写入配置或日志。
type Result ¶
type Result struct {
Output string
Diagnostics []converter.PDFImportDiagnostic
DiagnosticCount int
}
Result 包含已保存的路径及引擎报告的诊断。尚未保存时 Output 为空; 若发布成功后临时文件清理失败,则保留 Output 并同时返回错误。 Diagnostics 最多保留 100 条,DiagnosticCount 为诊断总数。
type StreamProgress ¶
StreamProgress 是可覆盖的进度快照,不持有所有已处理文件的记录。
type StreamSummary ¶
type StreamSummary struct {
StreamProgress
LastResult Result
OutputDir string
Details []string
DetailCount int
}
StreamSummary 保存计数和最多 100 条错误/诊断详情。
func RunStream ¶
func RunStream(ctx context.Context, source scan.Source, req Request, progress func(StreamProgress)) (StreamSummary, error)
RunStream 对一份来源边检索边转换,不预先收集目录中的文件列表。 目录重试会重新遍历,已完成的输出仍受重名保护,不提供断点续传。