色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

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

java使用Abobe Acrobat DC生成模板

瀏覽:8日期: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
相關文章:
主站蜘蛛池模板: 秋霞手机入口二日韩区 | 久热免费在线观看 | 欧美性毛片大片 | 国产福利精品在线观看 | 精品国产精品a | 99精品国产高清一区二区三区香蕉 | 日本黄色大片免费观看 | 日韩综合网站 | 成人高清视频在线观看 | 一级毛片在线看 | 国产a∨一区二区三区香蕉小说 | 国产福利不卡一区二区三区 | 一级毛片免费不卡夜夜欢 | 91亚洲在线 | 国产精品一二三区 | 久久在线国产 | 国产粉嫩高中生无套第一次 | 国产高清一级视频在线观看 | 黄a视频在线观看 | 国产区网址 | 亚洲精品色综合色在线观看 | 国产成人综合欧美精品久久 | 全黄a一级毛片 | 午夜精品久久久久久99热7777 | 最新国产精品亚洲二区 | 女人张开腿让男人捅的视频 | 91香蕉国产观看免费人人 | 日本免费一区二区三区看片 | 亚洲成a人片在线观看中文 亚洲成a人片在线观看中文!!! | 一级毛片在线观看视频 | 最新国产精品好看的国产精品 | 国产一国产一有一级毛片 | 在线精品视频在线观看高清 | 最新国产精品亚洲二区 | 婷婷国产成人久久精品激情 | 国产黄色三级 | 99成人国产精品视频 | 中文字幕综合 | 精品日韩在线视频一区二区三区 | 精品国产爱久久 | 亚洲人成网站在线在线 |