0
我正在閱讀.txt
文件中的一些文本並將它們寫入到pdf文件中。但在我的PDF文件中,文本顯示爲一些較大的字體。儘管我已經將.txt
文件的字體大小更改爲更大或更小,但pdf中的字體將相同。如何在寫入pdf文件時設置字體大小
部分的我的代碼,在文本文件中的工作與閱讀寫作
Document document = new Document(PageSize.A4.rotate(), 36, 36, 80, 160);
........
.........
document.newPage();
//Writing in a default page from the txt file
document.add(new com.lowagie.text.Paragraph("\n"));
iStream = new FileInputStream(path1); //path1 is location of .txt file
in = new DataInputStream(iStream);
is = new InputStreamReader(in);
br = new BufferedReader(is);
String strLine;
while ((strLine = br.readLine()) != null)
{
Paragraph para = new com.lowagie.text.Paragraph(strLine + "\n");
para.setAlignment(Element.ALIGN_JUSTIFIED);
document.add(new com.lowagie.text.Paragraph(strLine + "\n"));
}
br.close();
is.close();
in.close();
iStream.close();
document.close();
writer.close();
對不起,我利用iText的低版本,因爲現在我無法將任何第三方庫添加到我的偏東。這個版本的itext已經是我的Windchill了。
如何在寫入pdf文件時設置字體大小。任何幫助都會非常有幫助。
在哪裏可以傳遞字體大小到上面? –
UPS持有,讓我改正這一點。根據lowagie中實現的FontFactory的文檔,這應該起作用。 – AndMim