コマンドラインアプリケーションの戻り値でエラーの有無やコマンド処理の成否を確認することができます。
また、エラーが発生した場合は標準出力に表示されるエラーコードでエラーの内容を確認することができます。
本節はエラー処理について扱います。
コマンドラインアプリケーションの戻り値でコマンド処理の成否やエラーの有無を確認できます。
戻り値は環境変数[ERRORLEVEL]で判定可能です。
状態 |
戻り値 |
成功 |
0 |
パラメータエラー |
-1 |
PdfTk(『PDF Tool API』の内部ライブラリ)のエラー |
PdfTkのエラーコード |
その他のエラー |
-2 |
コマンドラインアプリケーションの戻り値は変数[$?]で判定可能です。
状態 |
戻り値 |
成功 |
0 |
エラー |
1 |
実行中に『PDF Tool API』の内部ライブラリであるPdfTk上でエラーが発生した場合は、標準出力にエラー内容を示すメッセージ文字列が出力されます。
エラーコード |
エラーメッセージ |
0 |
正常終了 |
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. |
118 |
Has XFA(XML Form). |
120 |
Can not certificate. |
200 |
Invalid parameter value. |
201 |
Invalid page number. |
202 |
Has no text. |
203 |
Has no font. |
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. |
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. |
235 |
Unsupported image for color key mask. |
236 |
Unsupported image for explicit mask. |
237 |
Image is not single. |
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. |
261 [*4] |
Free openmode error. |
262 [*4] |
Free embeddedfiles error. |
263 [*4] |
Free pages error. |
264 [*4] |
Free page error. |
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. |
291 |
Cannot read X509. |
500 [*6] |
Linearize processing error. |
700 |
null value. |
800 |
No Object. |
900 |
Not enough memory. |
901 |
Internal error. |
902 |
Other error. |
999 |
Sorry, not implemented. |
[*1]:210
PDFの暗号化設定処理においてパスワードの設定が行われていない場合に発生します。
[*2]:211
添付ファイルのみの暗号化設定処理において添付ファイルを開くためのパスワードが設定されていない場合に発生します。
[*3]:212
PDFのセキュリティ権限フラグ設定処理において権限パスワードの設定が行われていない場合に発生します。
[*4]:260/261/262/263/264
取得されたオブジェクトがPDFとは紐づいていない場合に発生します。
[*5]:271
しおりが作成できないことを示します。
[*6]:500
線形化処理=Web表示用に最適化する処理で問題が発生したことを意味します。