zoukankan      html  css  js  c++  java
  • itextpdf5生成document生成pdf的简单dome

    package dbzx.pdf;
    
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    
    import org.junit.Test;
    
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfWriter;
    
    public class CreateSimplePdf {
        
        @Test
        public void createSimplePdf() throws FileNotFoundException, DocumentException {
            String path = "E:/demo/pdfCreat/"+System.currentTimeMillis()+".pdf";//输出pdf的路径
            Document doc = new Document();
            PdfWriter.getInstance(doc, new FileOutputStream(path));
            doc.open();
            doc.add(new Paragraph("test"));//在pdf中打印文本
            doc.close();
            
            
        }
    }
    就算这个世道烂成一堆粪坑,那也不是你吃屎的理由
  • 相关阅读:
    代码1
    js中级第13天
    dom 浏览器模型
    js中级第12天
    js中级第11天
    js中级第十天
    js中级第九天
    js中级第8天
    js中级第六天
    js中级第七天
  • 原文地址:https://www.cnblogs.com/whalesea/p/11763719.html
Copyright © 2011-2022 走看看