TransformFile

文档操作、杂项函数

描述

对文件应用转换,允许重新编号和重新排序对象

在某些情况下,这会生成更紧凑的交叉引用表,从而减小 PDF 的大小

对象重新编号时,加密输入会保留其密码保护,包括从打包对象展开出来的字符串;所提供的密码必须能打开输入文档

TransformType = 2 写入交叉引用流,并把较旧的 PDF 版本提升到至少 1.5;重写会清除失效的混合交叉引用偏移量

语法

Delphi

Function TPDFlib.TransformFile(Const InputFileName, Password, OutputFileName: WideString; TransformType, Options: Integer): Integer;

ActiveX

Function PDFlib::TransformFile(InputFileName As String, Password As String, OutputFileName As String, TransformType As Long, Options As Long) As Long

DLL

int DLTransformFile(int InstanceID, const wchar_t* InputFileName, const wchar_t* Password, const wchar_t* OutputFileName, int TransformType, int Options);
int DLTransformFileA(int InstanceID, const char* InputFileName, const char* Password, const char* OutputFileName, int TransformType, int Options);

参数

InputFileName要转换的输入 PDF 的路径和文件名
Password输入 PDF 已加密时用于打开它的可选密码
OutputFileName要创建的已签名 PDF 的路径和文件名,应不同于 InputFileName
TransformType1 = 重新编号所有对象并按顺序写出 2 = 与 1 相同,但使用 xref 流
Options保留供将来使用,应设为零

返回值

1成功
2找不到输入 PDF
3输入 PDF 无法读取
4输入 PDF 密码不正确
5无法写入输出文件