PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
import CPDFGeneration.layout.*;
public class Example {
public static void main(String[] args) {
// 创建文档
CDocument document = new CDocument();
// 创建页面 (A4 尺寸: 595x842 点)
CPage page = document.createPage(595, 842);
// 创建 div 容器
CDiv div = page.createDivElement();
// 添加文本
CText text = div.createTextElement("Hello, PDF Generation!");
text.setFontSize(24);
text.setFontColor(CColor.BLACK);
// 保存到文件
document.saveToFile("output.pdf");
}
}