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

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

java使用Abobe Acrobat DC生成模板

瀏覽:2日期: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
相關文章:
主站蜘蛛池模板: 国产精品怡红院在线观看 | 免费一级欧美片在线观免看 | youjizz日韩| 欧美片网站免费 | 一区二区三区免费看 | 一级毛片视屏 | 久久精品一区二区三区不卡牛牛 | 国产高中生粉嫩无套第一次 | 国产精品日本不卡一区二区 | 中文字幕va一区二区三区 | 黄色毛片免费在线观看 | 福利一区三区 | 一级全黄视频 | 中文字幕国产亚洲 | 国产区一区二区三 | 欧美性色黄大片在线观看 | 在线精品国内外视频 | 成人综合在线视频 | 亚洲国产欧美另类 | 日本一级特黄aa毛片免费观看 | 午夜免费成人 | 99免费精品视频 | 国产日本韩国 | 国产精品久久久久久久人热 | 一级毛片免费观看不卡视频 | 动漫一级毛片 | 男女免费视频 | 亚洲欧美精品一区二区 | 日韩欧美一区二区中文字幕 | 亚洲人成在线影院 | 精品国产午夜肉伦伦影院 | a毛片免费播放全部完整 | 亚洲天堂小视频 | 日韩性大片免费 | 精品久久久久久久 | 欧美性高清bbbbbbxxxxx | 国产精品毛片天天看片 | 中文字幕国产一区 | 日韩在线视频不卡一区二区三区 | 一级特黄a免费大片 | 91精品成人免费国产 |