PDFにjavascriptを適用して、サイレントに印刷しようとしています。このコードのチャンクを見つけて貼り付けましたが、以下のエラーが発生します。
構文エラー: ありません。ステートメント 1 の前: 2 行目
これにより、以下のコードの最初の 2 行が強調表示されます。
Document document = new Document();
FileOutputStream fos = new FileOutputStream("APP_PERSONAL.pdf");
完全なコードは次のとおりです。
Document document = new Document();
FileOutputStream fos = new FileOutputStream("APP_PERSONAL.pdf");
try {
PdfWriter writer = PdfWriter.getInstance(document, fos);
document.open();
write.addJavaScript("this.print({bUI: false, bSilent: true, bShrinkToFit: true});",false);
write.addJavaScript("this.closeDoc();");
document.add(new Chunk("Silent Auto Print"));
document.close();
} catch (DocumentException e) {
e.printStackTrace();
}
行方不明のセミコロンがどこにあるかを理解するのに十分な知識はまだありません。その行の先頭にあるコードの 2 行目に欠落しているということですか?