isPDFValid method: PDFMerger class
Syntax
isPDFValid(PDFInputFile, Error)
Description
Use the isPDFValid method to test whether a PDF file has a valid structure and whether it can be expected to merge successfully when supplied as an input file to the MergePDFs method.
Parameters
| Parameter | Description |
|---|---|
|
PDFInputFile |
Specify the full path name of the PDF file you want to validate. Forward or back slashes are used in the path according to the operating system of the application server or Process Scheduler server. That is, on Unix servers, the directory separator is a forward slash, while a Windows server requires a path with back slashes. |
|
Error |
If any errors occur during processing, this parameter is populated with the text of the error message. |
Returns
A Boolean: true if the PDF file is validated successfully, false otherwise. If this method returns false, the Error parameter is populated with the text of the error message that occurred.
Example
import PSXP_ENGINE:PDFMerger;
Local PSXP_ENGINE:PDFMerger &oMerger = create PSXP_ENGINE:PDFMerger();
Local boolean &bResult;
Local string &sErr;
Local string &sInputFile = "c:\temp\PDF_input_files\file_to_be_merged.pdf";
&bResult = &oMerger.isPDFValid(&sInputFile, &sErr);
If Not &bResult Then
WriteToLog(%ApplicationLogFence_Error, "File " | &sInputFile | " will not merge successfully due to error: " | &sErr);
Else
WriteToLog(%ApplicationLogFence_Error, "File " | &sInputFile | " will merge successfully");
End-If;