SpringBoot + iTextPDF + Acrobat 构建动态PDF表单的完整实践

利用Adobe Acrobat DC制作pdf模板后,使用java直接生成pdf至本地指定路径或导出pdf文件 参考文章来源: springboot+itextpdf按模板生成PDF文件及在线下载PDF文件 JAVA根据模板生成PDF文件并导出 java将字符串按照指定长度分割成字符串数组 感谢上述博主大大,救我一命~~~ 我的系统环境:win10、IDEA、jdk1.8 一、Adobe Acrobat DC的下载 百度链接:链接:https://pan.baidu.com/s/1RSV8D6kXDbWeV2owgw2Zyg 提取码:f8p8 可自取。 二、模板准备 1、在word中画好模板,另存为pdf格式 我生成 阅读详情

需求

有个单据需要打印,单据需要自定义内容展示,单据尺寸、各个模块的布局都是固定的,内容包含文本内容以及Barcode128条形码等,该如何实现?单据部分截图如下:

在这里插入图片描述

分析

整个单据包含多个模块,如果用html网页的形式去开发,那么布局开发比较复杂,所以采用iTextPDF + Acrobat 构建动态PDF表单的方式开发。先用Acrobat制作好pdf模板,然后使用iTextPDF框架将数据写入pdf模板后直接打印。

分析下其中的难点以及关键点问题

1、springboot如何整合itextpdf ,需要引入itextpdf 的哪些包?

2、表单中的文本域有横向和纵向排列,如何设置文本域纵向展示?

3、itextpdf 如何生成Barcode128条形码?

4、itextpdf 如何将Barcode128条形码插入pdf表单中?

5、表单中的Barcode128条形码有横向和纵向排列,如何设置Barcode128条形码纵向展示?

实现过程

下面就一步步解决上述问题。

引入itextpdf 相关依赖

1、对于iText 5.x版,需要引入核心库itextpdf和中文字体支持的依赖包itext-asian,如下:

<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itextpdf</artifactId>
    <version>5.5.13</version>
</dependency>
<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itext-asian</artifactId>
    <version>5.2.0</version>
</dependency>

2、对于iText 7.x版本,引入核心类库itext7-core即可,当前最新版是9.3.0如下。

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

iText 7采用了全新的模块化架构,将功能拆分为多个独立模块,如itext7-core(核心功能)、itext7-layout(高级布局)、itext7-forms(表单处理)等。相比之下,iText 5采用单一架构,功能较为集中,许多模块相互混杂,引入的一些类可能不会被用到。新项目推荐使用iText 7‌,因为它具有更好的模块化设计和性能优化。

写入表单

1、第二个问题如何设置文本域纵向展示?这个主要是在Acrobat中编辑pdf表单来完成,双击文本域弹出文本域属性输入框->一般->通用属性->方向设置为90度。
在这里插入图片描述

2、第3到第5个问题,直接上代码进行解析,代码基于iText 7。

/**
 * 填充PDF表单并生成新文件
 *
 * @param templatePath 模板文件路径
 * @param outputPath   输出文件路径
 * @param formData     表单数据
 * @param barcodeData  二维码数据
 * @param flattenForm  是否扁平化表单(使字段不可编辑)
 * @throws IOException 文件操作异常
 */
public static void fillPdfForm(String templatePath, String outputPath, Map<String, String> formData,Map<String, String> barcodeData,boolean flattenForm) throws IOException {
    // 创建PDF读取器和写入器
    PdfReader reader = new PdfReader(templatePath);
    PdfWriter writer = new PdfWriter(new FileOutputStream(outputPath));
    PdfDocument pdfDoc = new PdfDocument(reader, writer);
    Document document = new Document(pdfDoc);
    // 获取表单对象
    PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, true);
    // 填充表单数据
    for (Map.Entry<String, String> entry : formData.entrySet()) {
        String fieldName = entry.getKey();
        String fieldValue = entry.getValue();
        PdfFormField field = form.getField(fieldName);
        if (field != null) {
            field.setValue(fieldValue);
        } else {
            log.info("警告:未找到字段 '" + fieldName + "'");
        }
    }
    //横向条形码设置
    // X坐标
    float x = 208;
    // Y坐标
    float y = 546;
    // 宽度
    float width = 120;
    // 高度
    float height = 25;
    addBarcode(pdfDoc, document, x, y, width, height, barcodeData.get("barcodeData1"), false);

    //纵向条形码设置
    // X坐标
    float x2 = 390;
    // Y坐标
    float y2 = 520;
    // 宽度
    float width2 = 120;
    // 高度
    float height2 = 25;
    addBarcode(pdfDoc, document, x2, y2, width2, height2, barcodeData.get("barcodeData2"), true);

    // 可选:扁平化表单(使字段成为文档内容的一部分,不可编辑)
    if (flattenForm) {
        form.flattenFields();
    }
    // 关闭文档
    pdfDoc.close();
    document.close();
}

上面这个函数主要对表单进行写入数据,生成一个新的pdf文件主要方便测试查看。生成条形码的的方法如下:

/**
 * 添加Barcode128条形码
 *
 * @param pdfDoc pdf文档对象
 * @param x 条形码横坐标
 * @param y 条形码纵坐标
 * @param width 条形码宽度
 * @param height 条形码高度
 * @param barcodeData 条形码数据
 * @param vertical 是否垂直展示
 */
private static void addBarcode(PdfDocument pdfDoc, Document document, float x, float y, float width, float height, String barcodeData, boolean vertical) {
    // 创建Barcode128条形码
    Barcode128 barcode128 = new Barcode128(pdfDoc);
    barcode128.setCode(barcodeData);
    // 不显示文本
    barcode128.setFont(null);
    barcode128.fitWidth(width);
    barcode128.setBarHeight(height);
    // 将条形码转换为表单XObject
    PdfFormXObject barcodeXObject = barcode128.createFormXObject(ColorConstants.BLACK, null, pdfDoc);
    // 在指定位置绘制条形码
    PdfCanvas canvas = new PdfCanvas(pdfDoc.getFirstPage());
    // 添加条形码标签
    document.add(new Paragraph(""));
    // 旋转90度实现纵向展示
    if (vertical) {
        // 3. 平移坐标系原点至目标位置
        canvas.concatMatrix(1, 0, 0, 1, x, y);
        // 4. 应用90度顺时针旋转变换,旋转后,原本水平绘制的条码将变为垂直
        canvas.concatMatrix(0, 1, -1, 0, 0, 0);
        barcode128.placeBarcode(canvas, null, null);
    } else {
        // 绘制条形码
        canvas.addXObjectAt(barcodeXObject, x, y);
    }
}

其中通过new Barcode128(pdfDoc)创建Barcode128条形码对象,横向展示条形码的时候通过

canvas.addXObjectAt(barcodeXObject, x, y) 将条形码插入到pdf表单的指定坐标(x,y)位置。

纵向展示的时候需要将二维码平移坐标系原点至目标位置,然后90度顺时针旋转变换,关键函数:

public PdfCanvas concatMatrix(double a, double b, double c, double d, double e, double f) {
   ...
}

方法中的六个参数共同定义了一个用于图形变换的 3×3 矩阵,各参数具体作用如下:
参数 a‌:控制图形在 X 轴方向的缩放比例。
参数 b‌:控制图形在水平方向的倾斜程度。
参数 c‌:控制图形在垂直方向的倾斜程度。
参数 d‌:控制图形在 Y 轴方向的缩放比例。
参数 e‌:指定图形在 X 轴方向的平移距离。
参数 f‌:指定图形在 Y 轴方向的平移距离。

测试

编写main函数进行测试。

public static void main(String[] args) {
        try {
            // 准备表单数据
            Map<String, String> formData = new HashMap<>();
            formData.put("orderNo", "*77582587758258");
            formData.put("position", "400B ");
            formData.put("position_no", "C262-11 C3");
         	//其他省略

            Map<String, String> barcodeData = new HashMap<>();
            barcodeData.put("barcodeData1","PROD-2025-001");
            barcodeData.put("barcodeData2","PROD-2025-002");
            // 填充表单并生成新文件
            fillPdfForm("C:\\Users\\user\\Desktop\\order.pdf", "new_order.pdf", formData,barcodeData,true);
            log.info("PDF表单填充完成,已生成新文件:new_order.pdf");
        } catch (IOException e) {
            log.error("处理PDF时发生错误:",e);
        }
    }
Java PDF生成实战:iText 7编程与模板填充核心技术解析 在企业级应用开发中,PDF文档的生成与处理是常见的需求,尤其是在报表、合同、票据等场景。其核心原理在于将数据与样式分离,通过编程或模板填充的方式动态生成标准化文档。这项技术的关键价值在于提升开发效率、保证文档格式统一,并支持批量处理。从技术实现层面,Java开发者通常借助成熟的PDF处理库来完成,其中iText作为生态中的老牌工具,提供了从零构建和模板填充两种主流方案。在实际应用中,根据文档版式的固定性与内容的动态性进行选型至关重要:对于格式固定、样式复杂的文档,推荐使用PDF模板填充技术;对于内容高度动态 阅读详情

相关推荐

数字电路基础(CMOS电路、低功耗方法)

文章目录一、CMOS器件1.1.CMOS反相器1.2. CMOS与非门1.3.CMOS或非门1.4 CMOS与门和CMOS或门二、CMOS电路参数——功耗 一、CMOS器件 1.1.CMOS反相器 CMOS反相器实现非门功能,由一个PMOS管和一个NMOS管组成,其逻辑电路图如下: 其真值表如下: In PMOS NMOS Out 0 √ 导通 ×关闭 1 1 ×关闭 √...

Mr.翟的博客 1万+

使用Itext/Itext7填充PDF表单域,并支持中文字体样式

在日常开发中,会遇到需要使用给定数据填充PDF模板的需求,常用的方案是使用Itext进行表单域填充,但填充的字体往往达不到预期,特别是需要支持多种字体的情况。本文将从创建模板开始,基于Itext7,实现自动匹配字体填充文本。

a6780144的博客 4987

云漾AI创作平台实战:如何用GPT4.0+Midjourney快速生成商业级插画(附Prompt模板)

本文详细介绍了如何利用云漾AI创作平台结合GPT4.0和Midjourney快速生成商业级插画。通过智能文案生成与视觉化工作流,大幅提升创作效率,适用于电商、社交媒体等多种场景。文章包含实用Prompt模板和参数调整技巧,帮助设计师和内容创作者高效产出专业插画。

weixin_29251567的博客 216

采用itextpdf 实现java的PDF生成与导出功能,含封装工具类代码

本文介绍了一种使用itextpdf库结合Spring Boot实现PDF导出的方法。通过制作PDF模板并利用字段填充的方式完成数据的自动填充,同时解决了中文显示及图片字段处理的问题。

qq_25720801的博客 7330

【SLAM论文笔记】SplaTAM论文小结

参考方法有ORB-SLAM3、Point-SLAM、NICE-SLAM、Kintinuous、ElasticFusion,测试数据集有ScanNet++、Replica、TUM-RGBD、Orig-ScanNet,SpaTAM并未在全部对比均为第一,表现最佳的是在ScanNet++、Replica,ScanNet++上SplaTAM方法位姿精度比第2名ORB-SLAM3高两个数量级,在TUM。上无稀疏SLAM结果,NICE-SLAM与Point-SLAM占优。SplaTAM基本做到了SOTA。

持之以恒 1008

六自由度机器人(机械臂)运动学建模及运动规划系列(一)——简介

毕业设计做了六轴机器人相关的课题,做完之后学到很多,在这里分享一下。

weixin_47849087的博客 2万+

SpringBoot + ITextPdf:高效生成 PDF 预览文件

解决方案我们先观察下真实的开票预览的模板。很明显的一个主子结构。了解了一下iTextPdf的相关api。要实现这个功能,其实我们需要分别生成两部分的发票信息,也就是两个pdf,然后将两个pdf拼接成同一个。对于第一部分的固定信息,我们可以用Acrobat之类的pdf设计工具设计出一个模板,然后在java程序中读取并填充对应的模板值。对于第二部分的商品信息,就需要获取商品数据,动态生成表格,当然iTextPdf是支持这一功能的。分别得到两部分的pdf之后,再将其合并为同一个pdf就可以了。

Small world 818

基于单片机自行车码表控制系统设计

*单片机设计介绍,基于单片机自行车码表控制系统设计。

QQ2193276455的博客 1487

springboot+itextpdf使用模板动态导出PDF

SpringBoot使用模板动态导出PDF使用

weixin_53251671的博客 1543

12、认知地图的建模与学习

本博客系统介绍了认知地图的定义、背景及其在机器智能领域的应用,重点探讨了模糊认知地图(FCMs)的建模方法与优势。文章还对比分析了几种主流的认知地图模型(如Axelrod模型、Kosko模型等),并讨论了模型的稳定性条件及实际应用前景。通过智能制造和医疗诊断的具体案例,展示了认知地图在复杂因果推理中的强大能力,并提出了模型优化方向与未来研究展望。

plant的博客 209

SAP ABAP CO核心扩展-为企业定制ZCKM3N物料价格分析增强(CKM3 CKM3N CKM8N)

这篇文章,将为大家讲述物料价格分析扩展增强(ZCKM3N)的方法和原理,并基于CKM3N的视图之一“CV成本组件”,教大家如何一步步实现批量输出多工厂物料的物料价格分析报表。

SAP李斌,本人承诺所有原创文章均不使用任何AI生成技术,请大家放心阅读。 3982

springboot使用itext填充pdf表单及导出pdf

由于最近开发的项目需要用到打印单据,就在网上找了一下方案,反反复复,都没有找到合适的,借鉴了网上资源,使用itext5、itext7的工具包,自己写了一个通用的pdf表单填充工具,简单易用,支持单页、分页单据打印,当然还有更多的定制化,需要大家自行扩展。打开转换好的pdf文件,选择工具栏右边的编辑表单,然后拖动顶部栏的表单域设计属性,属性值和和代码填充的要一致,字体下拉最后面的,不然你打印出来的单据字体会很难看,当然也可以在程序代码里去设计字体,一般设计好就够用了,如果没有特定要求的话。

aliqingge的博客 2531

利用NLP技术分析爬取的文本数据:Python爬虫与自然语言处理实战

网页爬虫(Web Crawler)是一种自动化脚本,通过模拟人类浏览网页的方式,定期抓取网页内容并进行分析和存储。对于大规模的数据抓取任务,爬虫技术提供了极大的便利。常见的Python爬虫库有requestsSelenium等。在本篇博客中,我们从爬取网页文本数据开始,通过清洗和预处理,最终利用自然语言处理技术(包括情感分析、文本分类等)对数据进行了深度分析。通过该过程,我们展示了如何使用Python爬虫抓取文本数据,并利用NLP技术进行分析和建模。

2201_76125261的博客 627

Adobe Acrobat DC + Java 生成pdf

springboot+itextpdf按模板生成PDF文件及在线下载PDF文件 JAVA根据模板生成PDF文件并导出 java将字符串按照指定长度分割成字符串数组

2186

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Springboot通过模板生成pdf文档带图片

标题Springboot利用itext通过模板生成pdf文档带图片功能

weixin_42600165的博客 1338

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

Java导出根据模板PDF(Springboot+Adobe Acrobat)

1、使用Adobe Acrobat创建PDF模板(设置文本域),文本域命名对应Java实体类。4、导出效果(字体和换行可在Adobe Acrobat中设置)3、编写实现类和控制类。

xiaosong2001的博客 1438

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

pdf模板生成与响应下载 + SpringBoot + itextpdf

1.制作PDF模板 1)新建Word文档 安装Adobe Acrobat DC 链接: https://pan.baidu.com/s/1sNGZhAFVPv-ufp6gGWg6Sw 提取码: 4dxh 2)新建的Word 通过软件转成PDF格式。 3)制备菜单 2.pom 添加依赖 <!-- pdf --> <dependency> <groupId>com.itextpdf</groupId> <arti...

qq_24091983的博客 607

springboot生成PDF文件返回给前台

1制作好自己的pdf模版,我这里是通过wps把word转换成pdf文件 2下载Adobe Acrobat DC工具来制作pdf的模板

weixin_37999518的博客 5113

SpringBoot 基于iText 根据PDF模板动态生成文件

链接:https://pan.baidu.com/s/1Vn3bIQ5_D17sEZnkF2t7gg?pwd = n6o1提取码:n6o1。

SpringHASh的博客 882

java springboot 生成pdf 亲测可用 附源码

实验时间: 2020-09-23 代码: https://github.com/mefly521/springbootAllinone spring-boot-pdf-template模块 本文介绍将一个制作好的模板自动填充上动态内容的方法. 网上有好多方法没有一一实验,因为有些不能跨平台,有些需要装dll 或其它第三方组件所以将其排除. 只介绍我实验成功的2种方法 : 方法1生成速度比较快,...

学无止境 190

Spring Boot中集成IText模版导出PDF

Spring Boot这里是用的2.3.12这个版本,比较老,但是别的版本应该也差不多 紧接着放入IText依赖,我是随便放了一个稳定版本,别的版本应该也可以,这个真没有过多的研究,感觉应该差不多,需要使用中文字体的话,导入itext-asian,一般应该是都需要的。 2. 准备字体 字体的话是比较方便的,如果是windows电脑的话,自己电脑里面就有,直接去里面就有自己电脑上的字体,一般采用的宋体,这个就看自己的需要了,不过操作的时候可要小心了,别直接裁剪出去了 找到自己需要使用的字体,随后复制到自己项

w15635748705的博客 1092

Spring Boot 数据源与 MyBatis(-Plus) 自定义配置详解

本文详解 Spring Boot 中单数据源环境下 HikariCP 与 MyBatis-Plus 的自定义配置。通过手动声明 SqlSessionFactory,实现下划线转驼峰、日志输出、一级缓存策略等精细化控制。结合 HikariCP 核心参数调优(如最大连接数、连接生命周期),确保高性能与稳定性。适用于仅需访问单一数据库的场景,避免多数据源复杂性,兼顾性能与可维护性。

BADAO_LIUMANG_QIZHI的博客 192

Spring Boot 工程通用能力建设:声明式事务定制与 Redis 缓存实践

本文探讨Spring Boot中声明式事务的进阶实践,通过解耦“切点”与“事务属性”,实现灵活控制。核心包括:基于方法名的只读规则(如get*、find*自动设为只读),组合事务属性源确保@Transactional注解优先于命名规则,以及自定义切点实现事务统一织入。该方案提升代码可维护性,避免误写,同时支持特殊场景覆盖,构建更健壮的事务治理体系。

BADAO_LIUMANG_QIZHI的博客 235

Spring Boot 缓存一致性怎么保证?@Cacheable、@CacheEvict 与事务提交时机实战

Spring Boot 项目中,为什么数据库更新成功后,接口仍然返回旧数据?本文从 Spring Cache 的工作机制入手,结合 @Cacheable、@CacheEvict、Caffeine 和事务同步回调,分析缓存失效时机、事务提交顺序及并发回填等常见问题,并提供代码示例、解决方案和测试思路,帮助开发者设计更可靠的缓存更新机制。

代码不止,探索不息 247

数据库乐观锁深度解析:MySQL、PostgreSQL 实战 + Spring Boot 集成指南

Oracle 提供了ORA_ROWSCN伪列(System Change Number),记录最后修改行的 SCN,类似 PostgreSQL 的xmin。实践中通常仍使用 version 字段方案,逻辑与 MySQL 完全相同。-- Oracle:通过 ORA_ROWSCN 实现乐观锁-- 更新时比对 SCN// 自定义注解// AOP 切面@Aspect@Component@Slf4jtry {

yjc_1111的专栏 396

Spring Boot 提速记:启动 40 秒到 8 秒,GC 停顿从 850ms 降到 60ms

面向线上 Spring Boot 服务,给出启动侧延迟初始化与 AOT 编译、运行侧 GC 与虚拟线程选型,再用分层压测验证收益,附可复制的参数与代码。

2301_78967866的博客 344
上一篇: 开发避坑指南(67):Maven引入iText7-core依赖失败解决方案
下一篇: 并发编程原理与实战(三十五)ThreadLocal内存泄露问题剖析与典型使用场景举例
帧栈
博客等级 码龄2年 335粉丝 120原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

帧栈

您的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值