導航:首頁 > 文件類型 > latex生成pdf文件很大

latex生成pdf文件很大

發布時間:2024-04-24 16:11:50

1. 使用itext對pdf操作後,為什麼生成pdf文件變大了

檢查下有沒有document.newPage()使得把數據放到下一頁了。
如果沒有,那就需要分析代碼。但是換種思路也能解決你問題:
把數據作為附件一,附件二等形式生成在pdf的最後,那樣就沒人關注pdf內容的空白了。
用iText生成PDF文檔需要5個步驟:
①建立com.lowagie.text.Document對象的實例。
Document document = new Document();
②建立一個書寫器(Writer)與document對象關聯,通過書寫器(Writer)可以將文檔寫入到磁碟中。
PDFWriter.getInstance(document, new FileOutputStream("Helloworld.PDF"));
③打開文檔。
document.open();
④向文檔中添加內容。
document.add(new Paragraph("Hello World"));
⑤關閉文檔。
document.close();
通過上面的5個步驟,就能產生一個Helloworld.PDF的文件,文件內容為"Hello World"。
建立com.lowagie.text.Document對象的實例
com.lowagie.text.Document對象的構建函數有三個,分別是:
public Document();
public Document(Rectangle pageSize);
public Document(Rectangle pageSize,
int marginLeft,
int marginRight,
int marginTop,
int marginBottom);

閱讀全文

與latex生成pdf文件很大相關的資料

熱點內容
安卓4寸16G 瀏覽:788
cad打開時彈出windows找不到文件 瀏覽:629
網路機頂買什麼好 瀏覽:351
java中字元串數組的聲明與初始化 瀏覽:675
天天酷跑更新版本2017 瀏覽:277
下載文件夾一到桌面 瀏覽:440
用手機壓縮文件的app 瀏覽:407
手機申請徵信找不到文件 瀏覽:865
手機tomato是什麼文件 瀏覽:898
如何檢測自己的電腦有沒有網路 瀏覽:955
孕周參照哪個數據最准 瀏覽:996
數據繼承後怎麼登陸 瀏覽:963
java獲取excel文件流 瀏覽:201
phpurl參數為json 瀏覽:792
在哪個app旅遊便宜 瀏覽:593
360千軍挖寶工具 瀏覽:684
淘寶導航代碼生成器 瀏覽:128
java足球游戲 瀏覽:72
中鐵局考試是什麼網站 瀏覽:950
filecopyjava 瀏覽:245

友情鏈接