久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      java生成pdf文件

      01 package com.hundsun.gildata.irp.core.action;
      02  
      03 import java.io.File;
      04 import java.io.FileOutputStream;
      05 import java.io.IOException;
      06 import com.hundsun.gildata.irp.common.util.ItextUtils;
      07 import com.itextpdf.text.Document;
      08 import com.itextpdf.text.PageSize;
      09 import com.itextpdf.text.pdf.PdfWriter;
      10  
      11 public class MakePdfTest {
      12      
      13     private String att;
      14  
      15     public void makdPdf() throws IOException {
      16 //      final int headFontSize = 18;
      17 //      final int sectionFontSize = 12;
      18         final int margin = 10;
      19         String filePath = "d:/aaa/";
      20         String fileName = "aa.pdf";
      21          
      22         att = filePath + fileName;
      23          
      24         File file = new File(filePath);
      25         if (!file.exists()) {
      26             file.mkdirs();
      27         }
      28         Document document = null;
      29         FileOutputStream fos = null;
      30         PdfWriter pdf = null;
      31         try {
      32             document = new Document(PageSize.A4, margin, margin, margin, margin);
      33             fos = new FileOutputStream(filePath + fileName);
      34             pdf = PdfWriter.getInstance(document, fos);
      35             document.open();
      36  
      37             String summary = "  this is a pdf made bycoden  另起一行".replaceAll("n", "<br/>").replaceAll(" ", "&nbsp;&nbsp;");
      38             document.add(ItextUtils.processViewpoint(summary));
      39              
      40             att = filePath + fileName;
      41              
      42  
      43         } catch (Exception e) {
      44             return;
      45         } finally {
      46             if (document != null) {
      47                 document.close();
      48             }
      49             if (pdf != null) {
      50                 pdf.close();
      51             }
      52             if (fos != null) {
      53                 fos.close();
      54             }
      55              
      56         }
      57     }
      58  
      59     public static void main(String[] args) {
      60          
      61         MakePdfTest testMake = new MakePdfTest();
      62         try {
      63             testMake.makdPdf();
      64             System.out.println(testMake.att);
      65         } catch (IOException e) {
      66             e.printStackTrace();
      67         }
      68  
      69     }
      70  
      71 }
      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號