在我的 java web 應(yīng)用程序中,我有一個波斯模板 word(docx) 文檔作為合同,它使用APACHE-POI為我的用戶自定義它的數(shù)據(jù),然后我必須將其轉(zhuǎn)換為 pdf 以防止文件被扭曲由運(yùn)營商。我嘗試使用itext轉(zhuǎn)換它,但我無法成功并且找不到有用的東西,有人可以建議一種使用 itext 進(jìn)行轉(zhuǎn)換的方法,或者有人可以告訴我是否有任何其他方法可以防止文件在不進(jìn)行轉(zhuǎn)換的情況下被扭曲?編輯說明:我使用以下代碼進(jìn)行了轉(zhuǎn)換,但現(xiàn)在我的 pdf 文件中有很多問號,有人可以幫忙嗎?itext 是否支持波斯語或 RTL 語言?我如何解決這個問題?我使用的是 iText 5.0.6 版??!convertWordToPdf("D:/PrivateBanking/docxCo.docx","D:/PrivateBanking/docxCo.pdf");public static void convertWordToPdf(String src, String desc){ try{ //create file inputstream object to read data from file FileInputStream fs=new FileInputStream(src); //create document object to wrap the file inputstream object XWPFDocument doc=new XWPFDocument(fs); //72 units=1 inch Document pdfdoc=new Document(PageSize.A4,72,72,72,72); //create a pdf writer object to write text to mypdf.pdf file PdfWriter pwriter=PdfWriter.getInstance(pdfdoc, new FileOutputStream(desc)); //specify the vertical space between the lines of text pwriter.setInitialLeading(20); //get all paragraphs from word docx List<XWPFParagraph> plist=doc.getParagraphs();
添加回答
舉報
0/150
提交
取消