ByteArrayOutputStream bos=null;
嘗試 {
PdfReader 閱讀器 = new PdfReader(pdf_byte);
bos = new ByteArrayOutputStream();
PdfStamper ps = new PdfStamper(reader, bos);
StringBuffer 腳本 = new StringBuffer();
script.append("this.print({bUI: false,bSilent: true,bShrinkToFit: false});").append("/r/nthis.closeDoc();");
ps.addJavaScript(script.toString());
//ps.addJavaScript("this.print(true);");
ps.setFormFlattening(true);
ps.close();
} catch (異常 e) {
e.printStackTrace();
}
返回 bos.toByteArray();
}