Search code examples
.netapache-poioffice-interopnpoi

Exporting DOC to PDF using POI


In our project in .NET (executed on a WS exposed on our Intranet Server) we wanted to do somethings with existing doc and docx documents, without office installed on the server of course :

  • accept all the pending changes in the doc (just like in the "accept all changes in the revision ribbon")
  • export to PDF (or images at worst-case scenario)

After spending our to check if these features are available on NPOI (the .net version of the project POI), I was unable to verify it. It doesn't seems to be a very often occurring case !!

Can anyone confirm me (or not) if it is possible?


Solution

  • The short answer is: No, currently (N)POI does not offer any functionality to export a PDF file. The library focuses on manipulating Microsoft Office documents directly, not on converting them to different formats.

    There are a lot of other libraries and services out there that will solve this (I can personally recommend Aspose.Words, but it should definitely be possible to find something cheaper out there that meets your requirements).