14–3 Error Handling

You can check the return value of the Command-line to see if there are any errors or whether the command processing was successful. If an error occurs, you can check the error code displayed on the standard output. This section deals with error handling.

14–3–1 Command-line Return Value

You can check the success or failure of command processing and whether there are any errors by checking the return value of the command line.

How to check the Command-line return value and the type of return value differ depending on the OS of the machine running the Command-line application of "Antenna House PDF API".

[Windows]

The return value can be determined using the environment variable "ERRORLEVEL".

Status
Return value
Success
0
Parameter error
-1
Error in PdfTk (internal library of Antenna House PDF API)
PdfTk error code
See “PdfTk Error Code List” in this manual.
Other error
-2

[Linux]

The return value of the Command-line can be determined using the variable "$?".

Status
Return Value
Success
0
Error
1

14–3–2 Error Details

If an error occurs in PdfTk, the internal library of "Antenna House PDF API", during execution, a message string indicating the error content will be output to standard output. Command-line error details are printed only to standard output.

For details on the error, see "PdfTk Error Code List" in this manual.

14–3–3 PdfTk Error Code List

Table14・1 PdfTk Error Code List
Error Code
Error Message
0
Normal termination.
10
Cannot find license file.
11
License file is expired.
12
License file is invalid.
13
License file is for the other platform.
14
License file is for other product.
100
Invalid PDF file.
101
Cannot read PDF.
102
Cannot write PDF.
103
Cannot write too large PDF.
110
Invalid user password.
111
Invalid owner password.
112
Invalid password
113
Has not authority.
114
Is not encrypted.
115
Unsupported security handler.
116
Unsupported security algorithm.
117
Is signatured.
Has a digital signature.
118
Has XFA(XML Form).
120
Can not certificate.
200
Invalid parameter value.
201
Invalid page number.
202
Has no text.
There is no text setting.
203
Has no font.
There is no font setting.
204
Has no valid data.
205
Cannot use this function.
210 *1
Need password.
211 *2
Need user password.
212 *3
Need owner password.
213
Invalid encrypt key length.
214
Invalid encrypt permission.
215
Invalid encrypt component.
216
Invalid encrypt method.
217
Need PKCS12.
A PKCS#12 file is required.
220
Can not read attached file.
221
Can not write attached file.
222
No attached file.
223
Attached file has no name.
230
Can not read image file.
231
Can not write image file.
232
Unsupported image.
233
Unsupported image for stencil mask.
234
Image is not single.
The stencil mask is not a monochrome binary image.
235
Unsupported image for color key mask.
236
Unsupported image for explicit mask.
237
Image is not single.
Explicit mask is not a monochrome binary image.
238
Image is not gray scale.
240
Image processing error.
241
Can not read ICC Profile.
245
Font processing error.
250
Can not insert page.
251
Can not delete page.
252
Has no pages.
260 *4
Free docproperty error.
DocProperty is free from document.
261 *4
Free openmode error.
OpenMode is free from document.
262 *4
Free embeddedfiles error.
EmbeddedFiles is free from document.
263 *4
Free pages error.
Pages are free from document.
264 *4
Free page error.
Page is free from document.
270
Can not set to root outline.
271 *5
Can not set to free outline.
280
Invalid FDF file.
281
Cannot read FDF.
282
Cannot write FDF.
290

Cannot read PKCS12.
Cannot read PKCS#12 file.
291

Cannot read X509.
Cannot read X.509 file.
500 *6
Linearize processing error.
700
null value.
800
No Object.
Object does not exist.
900
Not enough memory.
901
Internal error.
902
Other error.
999
Sorry, not implemented.