午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

java使用Abobe Acrobat DC生成模板

瀏覽:16日期:2022-08-14 09:18:22
一、利用word生成一個文檔轉成pdf

java使用Abobe Acrobat DC生成模板

說明:轉換成pdf格式

二、Abobe Acrobat DC圖解

利用Abobe Acrobat DC打開pdf

步驟:文件 ---->創建------>創建表單----->選擇文件(你轉換成pdf文件)

這里是所要增加的文本域、圖片域等功能按鈕

java使用Abobe Acrobat DC生成模板

在你需要的位置增加你說要的功能完成之后進行保存

java使用Abobe Acrobat DC生成模板

三、java后臺代碼

環境maven

<dependency><groupId>com.itextpdf</groupId><artifactId>itext7-core</artifactId><version>7.1.13</version><type>pom</type></dependency>

生成的模板文件放到適當的位置

java使用Abobe Acrobat DC生成模板

所需要生成新的pdf代碼

public @ResponseBody Object getFaceVerificationPdf(GzFaceVerification gzFaceVerification, HttpServletRequest request) throws IOException {try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { try (PdfDocument document = new PdfDocument(new PdfReader( new ClassPathResource('static/moban.pdf').getInputStream()), new PdfWriter(outputStream))) { PdfAcroForm pdfAcroForm = PdfAcroForm.getAcroForm(document, true); //對圖片進行處理(如果不處理在模板中顯示不出圖片) PdfFormField pdfFormField = pdfAcroForm.getField('frontIdCardUrl'); InputStream is = new FileInputStream(new File(gzFaceVerification.getFrontIdCardUrl())); String str = Base64.encodeBytes(StreamUtil.inputStreamToArray(is)); pdfFormField.setValue(str); pdfAcroForm.addField(pdfFormField); PdfFormField pdfFormField1 = pdfAcroForm.getField('reverseIdCardUrl'); InputStream is1 = new FileInputStream(new File(gzFaceVerification.getReverseIdCardUrl())); String str1 = Base64.encodeBytes(StreamUtil.inputStreamToArray(is1)); pdfFormField1.setValue(str1); pdfAcroForm.addField(pdfFormField1); PdfFormField pdfFormField2 = pdfAcroForm.getField('photo'); InputStream is2 = new FileInputStream(new File(gzFaceVerification.getPhoto())); String str2 = Base64.encodeBytes(StreamUtil.inputStreamToArray(is2)); pdfFormField2.setValue(str2); pdfAcroForm.addField(pdfFormField2); pdfAcroForm.getField('frontIdCardUrl').setValue(gzFaceVerification.getFrontIdCardUrl()); pdfAcroForm.getField('reverseIdCardUrl').setValue(gzFaceVerification.getReverseIdCardUrl()); pdfAcroForm.getField('photo').setValue(gzFaceVerification.getPhoto()); pdfAcroForm.getField('comparisonResults').setValue(gzFaceVerification.getComparisonResults()); pdfAcroForm.getField('createTime').setValue(gzFaceVerification.getCreateTime()); pdfAcroForm.flattenFields(); } HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_PDF); httpHeaders.setContentDispositionFormData('attachment', 'test.pdf', Charset.forName('UTF-8')); return ResponseEntity.ok().headers(httpHeaders).body(outputStream.toByteArray());} }

到此這篇關于java使用Abobe Acrobat DC生成模板的文章就介紹到這了,更多相關Abobe Acrobat DC生成模板內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Java
相關文章:
主站蜘蛛池模板: 一级的大片| 国产综合精品视频 | 天堂在线观看中文字幕 | 久久久精品网 | 国产成人小视频 | 午夜综合网 | 成人一区二区在线观看 | av免费播放 | 婷婷中文在线 | 国产一区二区 | 精品国产一区二区三区久久狼黑人 | 24小时日本在线www免费的 | 91亚洲精品在线观看 | 欧美爽爽爽 | 日韩高清黄色 | 黄色九九 | 日本视频www | 国产精品久久久久av | 国产无遮挡又黄又爽在线观看 | 岛国久久久 | 欧美精品日韩少妇 | 色国产精品| 日韩中文字幕观看 | 在线观看国产小视频 | 手机成人在线 | 韩国精品av | 日本猛少妇色xxxxx猛叫 | 成人a免费 | 亚洲精品午夜国产va久久成人 | 国产成人精品视频免费 | 日韩美女视频一区 | 日韩色图片 | 午夜在线观看视频网站 | 国产又爽又黄视频 | 亚洲黄色视屏 | 欧美国产日韩一区二区三区 | 亚洲美女啪啪 | 亚洲图片另类 | 色av影院| 伊人www | 涩涩涩涩色 |