亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

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

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
相關文章:
主站蜘蛛池模板: 精品国产第一国产综合精品gif | 国内精品不卡一区二区三区 | 免费看三级毛片 | 91夜夜操| 欧美一区二三区 | 欧美日韩亚洲m码色帝国 | 亚洲精品高清在线 | 国产免费jizz在线播放视频 | 亚洲aav| 国产午夜精品理论片久久影视 | h网在线 | 日本黄色小视频在线观看 | 456亚洲老头视频 | 欧美一级特黄aa大片 | 欧美成人伊人久久综合网 | 国产精品久久久久免费a∨ 国产精品久久久久这里只有精品 | 国内精品自在自线2020 | 久久久综合九色合综国产 | 国产精品yjizz视频网一二区 | 日本免费高清一区 | 欧美亚洲日本一区二区三区浪人 | 在线一级视频 | 久久视热这只是精品222 | 喷潮白浆直流在线播放 | 免费在线观看一区二区 | 国产美女无遮挡免费视频网站 | 精品不卡 | 亚洲步兵一区二区三区 | 一级aa免费视频毛片 | 中文福利视频 | 大伊香蕉在线观看视频 wap | 青青国产成人久久91网站站 | 91精品视频在线观看免费 | 伊人久久丁香色婷婷啪啪 | 99re久久在热线播放最新地址 | 我我色综合| 亚洲一区二区三区免费视频 | 成人的天堂视频一区二区三区 | 男女污污网站 | 国产精品亚洲视频 | 91精品视频播放 |