Java:using apache POI how to convert ms word file to pdf?

后端 未结 7 2151
旧巷少年郎
旧巷少年郎 2020-12-02 13:43

By using apache POI how to convert ms word file to pdf?

I an using the following code but its not working giving errors I gues

7条回答
  •  清歌不尽
    2020-12-02 14:39

    As a side note, it's also possible to read content on-the-fly directly from a Word/Excel content stream instead of reading it from the filesystem and serializing it to disk, for example when retrieving content from CMIS repositories:

    e.g.

     //HWPFDocument docx = new HWPFDocument(fs);  
     HWPFDocument docx = new HWPFDocument(doc.getContentStream().getStream()); 
    

    (doc is of type org.apache.chemistry.opencmis.client.api.Document and in this case I adapted your code to retrieve a word file from an Alfresco repository by means of opencmis and transformed it to PDF)

    HTH

提交回复
热议问题