I've got a project that involves reading pdf files and it is turning out to be more difficult than I had anticipated. Is there a library I can use to convert the pdf to docx so I can use the OpenXml SDK to parse it?

  • openoffice|libreoffice has a headless format conversion command/mode - can you simply exec() something else?
    – ivanivan
    Jun 21, 2018 at 21:50
  • What I had planned on doing was converting a pdf document into a temp word file, then reading that file with openxml, and then deleting the temp file. I'm on windows btw so libreoffice won't work. I'm not familiar with openoffice. Jun 21, 2018 at 21:52

2 Answers 2


AbleWord (for Windows):

AbleWord is a very capable word processing application that can read and write most popular document formats including PDF's. It is fully featured, supporting image formatting, tables, headers & footers and includes spell checking and print preview functions. Best of all it is totally free even for commercial use.

Instructions for convert PDF to Word (including docx) can be found here.

  • I'm looking for code libraries that I can do this with, not an application. I want the program to do it automatically, not require another step for the user to follow before parsing the data. Jun 22, 2018 at 14:45
  • @emsimpson92 You can execute it from your program and retrieve the result.
    – AFract
    Jun 30, 2018 at 18:21

It appears you might achieve your requirement by parsing the contents of PDF using C#. If that's true, and what you need is mainly text, the following article discusses some free (and not so free) options for getting text from PDF: https://www.codeproject.com/Articles/12445/Converting-PDF-to-Text-in-C

If you don't simply need text, but require different contents of PDF like text, images and annotations, you might have to use a professional SDK such as LEADTOOLS. (Disclaimer: I am an employee of this library's vendor). The code to extract text is this:

StringBuilder sb;
sb = new StringBuilder();
PDFDocument document = new PDFDocument("filename.pdf");
PDFParsePagesOptions options = PDFParsePagesOptions.Objects;
document.ParsePages(options, 1, -1);
foreach (PDFDocumentPage page in document.Pages)
   Console.WriteLine("Page #" + page.PageNumber.ToString() + " Started");
   foreach (PDFObject obj in page.Objects)
      if (obj.ObjectType == PDFObjectType.Text)
         if (obj.TextProperties.IsEndOfLine)
   Console.WriteLine("Page #" + page.PageNumber.ToString() + " finished");   
this.Text = "Finished";
textBox1.Text = sb.ToString();

Similar code (but using different flags), can be used to obtain images and other object types.

If you don't wish to parse the PDF but only convert it to DOCX, LEADTOOLS also has a DocumentConverter class that can do that.

The toolkit has a free evaluation edition that you can try before you decide whether to purchase or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.