2013-08-28 59 views
0

我想將我的代碼更新到itext 5.4.3。它被寫入earlir版本的itext,即2.1.7。Itext:如何處理itext 5.4.3?

我在聲明表,段落和所有東西時遇到問題。 我前面的代碼是這樣的:

Table tab = new Table(); 
tab.setWidth(100); 
tab.addCell(new Paragraph("Sr. No.")); 
tab.addCell(new Paragraph("Candidate Name",new Font(Font.HELVETICA, 14, Font.BOLD))); 
tab.addCell(new Paragraph("Candidate Code",new Font(Font.HELVETICA, 14, Font.BOLD))); 
tab.addCell(new Paragraph("Login ID",new Font(Font.HELVETICA, 14, Font.BOLD))); 
tab.addCell(new Paragraph("Password",new Font(Font.HELVETICA, 14, Font.BOLD))); 

所以請讓我知道解決的辦法或鏈接,基於使用的iText 5.4.3版本的教程。

+1

導入新版本的iText並使用新的[API](http://api.itextpdf.com/itext/)。 – araknoid

+0

是的,我有新版本的itext,但我不知道語法。因爲在這個版本上面的代碼的語法不起作用。這就是爲什麼我在尋找一些基於itext 5.4.3 API – bajrangi

回答

1

檢查這個iText Tutorial。 看起來相當完整,你正在尋找什麼。

+0

的好例子似乎比較老。因爲在5.4.3的最新版本中沒有table.addcell()的方法。 – bajrangi

+0

@amitsingh我在5.4.3中使用了這個例子,並且運行沒有任何問題。還請檢查[PdfPTable API](http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfPTable.html) – araknoid

+0

k ...我再試一次。 – bajrangi