av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

您的位置:首頁技術(shù)文章
文章詳情頁

java使用Abobe Acrobat DC生成模板

瀏覽:2日期:2022-08-14 09:18:22
一、利用word生成一個(gè)文檔轉(zhuǎn)成pdf

java使用Abobe Acrobat DC生成模板

說明:轉(zhuǎn)換成pdf格式

二、Abobe Acrobat DC圖解

利用Abobe Acrobat DC打開pdf

步驟:文件 ---->創(chuàng)建------>創(chuàng)建表單----->選擇文件(你轉(zhuǎn)換成pdf文件)

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

java使用Abobe Acrobat DC生成模板

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

java使用Abobe Acrobat DC生成模板

三、java后臺代碼

環(huán)境maven

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

生成的模板文件放到適當(dāng)?shù)奈恢?/b>

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); //對圖片進(jìn)行處理(如果不處理在模板中顯示不出圖片) 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());} }

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

標(biāo)簽: Java
相關(guān)文章:
主站蜘蛛池模板: 国产福利视频在线 | 欧美在线亚洲 | 国产永久视频 | 日韩不卡在线 | 国产91精品看黄网站在线观看 | 欧美激情在线观看 | 黄色片视频 | 狠狠干在线视频 | 毛片久久 | 国产日韩精品在线 | 色天天综合| 草草免费视频 | 伊人国产精品 | 国产不卡在线观看 | 成人在线观看视频网站 | 国产精品美女 | 国产第一页在线 | 国产区在线视频 | 国产午夜视频 | 日韩一区二区在线播放 | 欧美日韩视频 | 欧美性猛交99久久久久99按摩 | 日韩精品免费视频 | 日韩在线高清 | 成人毛片在线观看 | 国产视频一区二区三区四区 | 特黄一级视频 | 国产精品一区二区视频 | 天天操夜夜操 | 超碰av在线播放 | 国产成人三级一区二区在线观看一 | 欧美日韩综合网 | 欧美福利影院 | 久久久综合 | 成人黄色免费网站 | 激情婷婷| 久久成人毛片 | avxxxxx | 国产网友自拍 | 国产亚洲天堂 | 一区在线播放 |