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

InputFileNameThe path and file name of the input PDF to transform.
PasswordThe optional password to open the input PDF if it is encrypted
OutputFileNameThe path and file name of the transformed PDF to create. This should be different to InputFileName.
TransformType1 = Renumber all objects writing them out in order 2 = Same as 1 but uses an xref stream
OptionsReserved for future use, should be set to zero.

Return values

1Success
2Input PDF not found
3Input PDF cannot be read
4Input PDF password incorrect
5Could not write output file