首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏XAI

    【iText5 生成PDF】纯Java代码实现生成PDF(自定义表格、文本水印、单元格样式)

    cell 列 * @param text 文本 * @return void **/ public static void addTableGroupTitle(PdfPTable * @param colspan 需要合并的列 * @return void **/ public static void addTableGroupTitle(PdfPTable 核查建议内容文字颜色 * @return com.itextpdf.text.Element **/ public static void addSuggestLine(PdfPTable tableBaseInfoIndex = new PdfPTable(1); tableBaseInfoIndex.setWidthPercentage(20); PdfPCell table = new PdfPTable(2); table.setWidthPercentage(100); table.setHorizontalAlignment

    9.3K31发布于 2019-07-22
  • 来自专栏中间件的探究

    itextPdf工具类使用纪实-01

    内容的间距 header.setSpacingAfter(10); document.add(header); //4.2、添加标题 PdfPTable } p2.setSpacingAfter(40); document.add(p2); //4.4、列合并 --员工职称列合并 PdfPTable colContent.setSpacingAfter(10); document.add(colContent); //4.5、行合并 -员工列表信息行合并 PdfPTable createTable(float[] widths) { PdfPTable table = new PdfPTable(widths); try { table = new PdfPTable(2); try { //1、设置header的长度 table.setTotalWidth(

    1.5K30编辑于 2023-03-01
  • 来自专栏全栈程序员必看

    iText5实现Java生成PDF文件完整版

    table =new PdfPTable(3); table.setTotalWidth(300); table.setLockedWidth(true); PdfPCell cell; cell celltable =new PdfPTable(2); cell =new PdfPCell(celltable); cell.setRowspan(2); cell.setBorderWidth createTable(int colNumber, int align) { PdfPTable table = new PdfPTable(colNumber); try { table.setTotalWidth createTable(float[] widths) { PdfPTable table = new PdfPTable(widths); try { table.setTotalWidth createBlankTable() { PdfPTable table = new PdfPTable(1); table.getDefaultCell().setBorder(0);

    8.2K10编辑于 2022-07-02
  • 来自专栏全栈程序员必看

    itextpdf生成表格的常见用法

    new Document(); PdfWriter.getInstance(document, new FileOutputStream(DEST)); document.open(); PdfPTable table = new PdfPTable(5); for (int aw = 0; aw < 10; aw++) { // 构建每一格 table.addCell("cell"); PdfWriter.getInstance(document, new FileOutputStream(DEST)); // 打开文档 document.open(); // 添加表格,4列 PdfPTable table = new PdfPTable(4); 设置表格宽度比例为%100 table.setWidthPercentage(100); // 设置表格的宽度 table.setTotalWidth table = new PdfPTable(1); // 宽度300 table.setTotalWidth(300); table.setLockedWidth(true); PdfPCell

    2.6K20编辑于 2022-07-02
  • 来自专栏OSChina

    spring-boot整合PDF打印

    com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable } /** * 创建table * * @param colNumber * @return */ public static PdfPTable createTable(int colNumber) { PdfPTable table = new PdfPTable(colNumber); try { table; } /** * 创建table * * @param widths * @return */ public PdfPTable createTable(float[] widths) { PdfPTable table = new PdfPTable(widths); try {

    2.2K20发布于 2019-10-08
  • 来自专栏小特工作室

    基于iTextSharp的PDF文档操作

    代码如下: private static pdfText.pdf.PdfPTable CreatePdfPTableToPickupLabel(List<TradeDetailModel> listDetail , iTextSharp.text.Font font) { pdfText.pdf.PdfPTable pdtTable = new pdfText.pdf.PdfPTable(5); pdfText.pdf.PdfWriter.GetInstance(document, fs); document.Open(); //增加拣货单品列表 pdfText.pdf.PdfPTable pdfpTable = PdfUtil.CreatePdfPTableToPickupLabel(modelTrade.Details, font); document.Add(pdfpTable

    2.4K100发布于 2018-02-01
  • 怎么通过itextpdf架包实现报表导出为pdf文件?

    import com.itextpdf.text.pdf.BaseFont;import com.itextpdf.text.pdf.PdfPCell;import com.itextpdf.text.pdf.PdfPTable document.setPageSize(PageSize.A4); document.open(); float[] widths = {144, 113, 191}; PdfPTable table = new PdfPTable(widths); table.setLockedWidth(true); table.setTotalWidth(458); pdfCell = new PdfPCell(); pdfCell.setRowspan(1); pdfCell.setColspan(2); PdfPTable suTtable = new PdfPTable(new float[]{100, 100}); PdfPCell subPdfCell = new PdfPCell();

    51810编辑于 2024-08-01
  • SpringBoot + ITextPdf:高效生成 PDF 预览文件

    这里我们需要新建一个Document,在这个Document中动态创建一个表格对象PdfPTable最后将Document关闭。 添加文本内容 document.add(new Paragraph("Test PDF with Table")); // 创建表格 PdfPTable table = new PdfPTable(2); table.addCell("Name"); table.addCell("Age"); ; } catch (Exception e) { e.printStackTrace(); } }}声明PdfPTable对象后(需指定列的数目 table = new PdfPTable(headRowMetaInfos.size()); // 表宽度 table.setTotalWidth(totalWidth); //

    2.8K11编辑于 2024-10-08
  • 来自专栏故久

    itext根据模板生成pdf(支持分页)

    table1 = new PdfPTable(column1); float tatalWidth = signRect1.getRight() - signRect1 System.out.println(pcb2); //表格位置 int column2 = 5; PdfPTable table2 = new PdfPTable(column2); float tatalWidth2 = signRect2.getRight() - signRect2 column3 = lists2.get(0).size(); int row3 = lists2.size(); PdfPTable table = new PdfPTable(column); float tatalWidth = signRect.getRight() - signRect.getLeft

    4.3K20发布于 2019-09-29
  • 来自专栏爱编码

    Springboot输出PDF文件

    table = new PdfPTable(3); PdfPCell cell; cell = new PdfPCell(new Phrase("Cell with colspan 3")); table.addCell("row 2; cell 1"); table.addCell("row 2; cell 2"); document.add(table); 7、表格嵌套 PdfPTable table = new PdfPTable(4); //1行2列 PdfPTable nested1 = new PdfPTable(2); nested1.addCell("1.1"); nested1.addCell("1.2"); //2行1列 PdfPTable nested2 = new PdfPTable(1); nested2.addCell("2.1"); nested2 datatable = new PdfPTable(NumColumns); int headerwidths[] = { 9, 4, 8, 10, 8, 11, 9, 7, 9, 10, 4,

    3.5K31发布于 2019-09-27
  • 来自专栏LeoXu的博客

    iText的使用

    table = new PdfPTable(1); 带有一个入参的构造方法,这个参数表示表格的列数。 paragraph9.setSpacingBefore(12); cell3.addElement(paragraph9); table.addCell(cell3); 表格的列宽也可以调用方法来进行设置: PdfPTable table = new PdfPTable(3); table.setLockedWidth(true); table.setWidthPercentage(100); float[] columnWidths ("中文字符", font1); PdfPCell cell1 = new PdfPCell(); cell1.setBorder(0); cell1.addElement(paragraph1); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100); table.addCell(cell1); 只要ttf文件里面对字符的定义全的话,基本上就不会出什么问题了

    2.8K10发布于 2018-08-15
  • 来自专栏JAVA

    从xls或xlsx文件转换为PDF文件的Java代码示例

    com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable DecimalFormat df = new DecimalFormat("#"); for (Sheet sheet : workbook) { PdfPTable table = new PdfPTable(sheet.getRow(0).getPhysicalNumberOfCells()); for (Row row : sheet

    1.7K10编辑于 2024-11-20
  • 来自专栏挖坑填坑

    .net core 项目中几款常用类库收藏

    bsFont); float[] clos = new float[] { 40,40,40,20,20,30,30,30};// 宽度 PdfPTable tablerow1 = new PdfPTable(clos); foreach (string t in title) {

    1.3K30发布于 2018-08-21
  • 来自专栏故久

    Itext根据模板生成pdf

    table = new PdfPTable(column); float tatalWidth = signRect.getRight() - signRect.getLeft row = lists.size(); System.out.println(column+"column"+"row"+row); PdfPTable table = new PdfPTable(column); float tatalWidth = signRect.getRight() - signRect.getLeft table = new PdfPTable(column); float tatalWidth = signRect.getRight() - signRect.getLeft table = new PdfPTable(column); float tatalWidth = signRect.getRight() - signRect.getLeft

    3.6K50发布于 2019-09-29
  • 来自专栏王念博客

    java(iText)工具包生成PDF

    com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfPHeaderCell; import com.itextpdf.text.pdf.PdfPTable font)); document.add(new Paragraph("\n\r", font)); // 创建表格,5列的表格 PdfPTable table = new PdfPTable(4); table.setTotalWidth(PageSize.A4.getWidth()- 100); table.setLockedWidth // 一页加载完成触发,写入页眉和页脚 public void onEndPage(PdfWriter writer, Document document) { PdfPTable table = new PdfPTable(3); try { table.setTotalWidth(PageSize.A4.getWidth() - 100

    11.3K23发布于 2019-07-25
  • 来自专栏知了一笑

    文件系统(01):基于SpringBoot框架,管理Excel和PDF

    width, height); } return image ; } /** * 表格生成 */ public static PdfPTable getPdfPTable01 (int numColumns,float totalWidth) throws Exception { // 表格处理 PdfPTable table = new PdfPTable(numColumns); // 设置表格宽度比例为%100 table.setWidthPercentage(100); return new PdfPCell (phrase) ; } /** * 表格内容带样式 */ public static void addTableCell (PdfPTable // 数据表格 document.add(PdfFontUtil.getParagraph("\n· 数据详情\n\n",BLOCK_FONT,-1)) ; PdfPTable

    2K31发布于 2020-02-17
  • 来自专栏IT民工的代码世界

    SpringBoot集成itextpdf动态生成pdf并展示

    Paragraph("接口", interFont)); } document.add(chapter); } document.close(); 添加表格 PdfPTable table = new PdfPTable(3);//生成一个3列的表格 //表格垂直居中 table.setHorizontalAlignment(Element.ALIGN_CENTER)

    1.5K30编辑于 2023-07-19
  • 来自专栏全栈程序员必看

    itextpdf设置页码_word页码相同怎么改

    com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable )); document.add(home); // document.add(line); document.add(newLine); document.add(newLine); PdfPTable riskDashTb = new PdfPTable(2); riskDashTb.setWidths(new float[]{0.4f, 0.6f});// 每个单元格占多宽 riskDashTb.setWidthPercentage

    4.6K30编辑于 2022-11-14
  • 来自专栏明明如月的技术专栏

    Spring 4 MVC 视图解析器(XML JSON PDF等) 纯注解(带源码)【推荐】

    org.springframework.web.servlet.view.document.AbstractPdfView; import com.lowagie.text.Document; import com.lowagie.text.Element; import com.lowagie.text.pdf.PdfPTable HttpServletResponse response) throws Exception { Pizza pizza = (Pizza) model.get("pizza"); PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER

    3K30发布于 2021-08-27
  • 来自专栏C#

    开源免费且稳定实用的.NET PDF打印组件itextSharp(.NET组件介绍之八)

    Paragraph:报表中的文本;Image:报表中的图片;PdfPTable:表格;PdfPCell:单元格。    1.Document类Open()方法:打开文档对象。

    8.6K50发布于 2018-01-04
领券