導航:首頁 > 文件類型 > 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文件很大相關的資料

熱點內容
蘋果手機密碼6位變4位 瀏覽:651
編程如何讓人物踢球 瀏覽:884
win10防藍光軟體下載 瀏覽:983
qq群文件容量 瀏覽:164
有什麼網站驗證pr 瀏覽:186
如何拍攝飄浮照片教程 瀏覽:366
劍靈白青版本刺客 瀏覽:965
卡車在哪個app可以接單 瀏覽:526
怎麼讀編程文檔java 瀏覽:501
基礎資料庫和半導體哪個好 瀏覽:118
word顯示隱藏標記 瀏覽:63
win10f4麥克風設置 瀏覽:426
昆明碼高少兒編程在哪裡 瀏覽:508
雲資料庫哪個牌子好 瀏覽:479
掃描文件多高解析度 瀏覽:487
蘋果手機js指得是什麼 瀏覽:225
編程適合什麼筆記本 瀏覽:783
c讀文本到資料庫 瀏覽:981
2010word文字背景顏色怎麼去掉 瀏覽:515
網路安全情況核查台賬是什麼 瀏覽:590

友情鏈接