2017-07-09 116 views
0

我想要一点后R字转换为PDF与阿拉伯字母, & DI决定使用使用阿拉伯语和波斯语中XWPFDocument

org.apache.poi.xwpf.converter.pdf.PdfConverter

但是当我写下面的代码时,最后的结果是从左到右,例如对于“سعید”导致pdf是混乱的单词是“سعید”我的docx非常大而不是一个段落:

public class ConvertWord { 
    public static void ConvertToPDF(String docPath, String pdfPath) { 
     try { 
      InputStream doc = new FileInputStream(new File(docPath)); 
      XWPFDocument document = new 


      PdfOptions options = PdfOptions.create(); 
      options.fontEncoding("UTF-8") 

      OutputStream out = new FileOutputStream(new File(pdfPath)); 

      PdfConverter.getInstance().convert(document,out,options); 

     } catch (FileNotFoundException ex) { 

     } catch (IOException ex) { 

     } 
    } 

    public static void main(String[] args) { 
     ConvertWord cwoWord=new ConvertWord(); 
     cwoWord.ConvertToPDF("D://" + "usc.docx","D://test12.pdf"); 

    } 



    } 

回答

1

此线程:Creating PDF document from Word document using java api,包含您可以使用的其他库。我不认为这个库,你正在使用,将支持布局选项;它也包含许多错误,不支持这里提到的表格,图表,页码:https://github.com/opensagres/xdocreport/wiki/XWPFConverterPDFViaIText

+0

您提供哪些图书馆支持波斯语? –

+0

说实话,我没有使用它们中的任何一个,但是,通过他们的API很容易,并且检查哪一个提供了这样的右侧布局或类似的东西。 –

相关问题