摘要: 使用自定义字体 package aoye import com.itextpdf.text.BaseColor import com.itextpdf.text.Font import com.itextpdf.text.FontFactory import com.itextpdf.text.pd 阅读全文
posted @ 2022-11-28 10:59 duchaoqun 阅读(160) 评论(0) 推荐(0) 编辑
摘要: com.itextpdf.text.PdfPTable Demo 注意:表格中的列必须填满,否则表格不显示。 PdfPTable table = new PdfPTable(3) // 设置表格的填充宽度百分比,在当前 Table 和其父级的左右宽度微调的时候使用。 table.setWidthPe 阅读全文
posted @ 2022-11-28 10:58 duchaoqun 阅读(310) 评论(0) 推荐(0) 编辑
摘要: com.itextpdf.text.Paragraph 注意:声明对象的时候最好默认指定 leading // 可以直接制定行间距。 Paragraph paragraph = new Paragraph(10) // 行间距,对应小四号字(12),20磅刚刚好 paragraph.setLeadi 阅读全文
posted @ 2022-11-28 10:55 duchaoqun 阅读(686) 评论(0) 推荐(0) 编辑
摘要: com.itextpdf.text.Image 在插入图像到指定位置的时候,我们最好使用表格进行布局,不要直接设置图像的相对位置。 在相对位置上插入图片 // 在文件中插入图像: String imgURL = "https://blog-static.cnblogs.com/files/ducha 阅读全文
posted @ 2022-11-28 10:52 duchaoqun 阅读(850) 评论(0) 推荐(0) 编辑
摘要: // 创建 Document 对象,就是对应的文档对象。 Document document =new Document() // 使用默认的 A4 尺寸创建:import com.itextpdf.text.PageSize -> RectangleReadOnly(595,842) Docume 阅读全文
posted @ 2022-11-28 10:50 duchaoqun 阅读(392) 评论(0) 推荐(0) 编辑
摘要: // 文字块,中文字体需要指定。 Chunk c1 = new Chunk("文字文字", customFont.font12) // 加上下划线: // 第一个参数是线的厚度 // 第二个参数是线的位置,如果是 0 就紧贴在文字下面,-2 就沿着 y 轴向下移动2 c1.setUnderline( 阅读全文
posted @ 2022-11-28 10:44 duchaoqun 阅读(269) 评论(0) 推荐(0) 编辑