TransformFile
Document manipulation, Miscellaneous functions
Description
Applies a transformation to a file allowing objects to be renumbered and reordered.
In certain cases this can result in a more compact cross reference table reducing the size of the PDF.
Encrypted input retains its password protection when objects are renumbered, including strings expanded from packed objects; the supplied password must open the input document
TransformType = 2 writes a cross-reference stream and raises an older PDF version to at least 1.5; rewriting removes stale hybrid cross-reference offsets
Syntax
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);
Parameters
| InputFileName | The path and file name of the input PDF to transform. |
|---|---|
| Password | The optional password to open the input PDF if it is encrypted |
| OutputFileName | The path and file name of the transformed PDF to create. This should be different to InputFileName. |
| TransformType | 1 = Renumber all objects writing them out in order 2 = Same as 1 but uses an xref stream |
| Options | Reserved for future use, should be set to zero. |
Return values
| 1 | Success |
|---|---|
| 2 | Input PDF not found |
| 3 | Input PDF cannot be read |
| 4 | Input PDF password incorrect |
| 5 | Could not write output file |