I am using the following libreoffice command to convert my pdf files into word(doc)

lowriter --headless --infilter='writer_pdf_import' --convert-to doc:"MS Word 2007 XML" sample.pdf

After converting the output document is having each line bordered with a rectangular box. But if I use the same command with MS Word 97 it is working perfectly.

 lowriter --headless --infilter='writer_pdf_import' --convert-to doc:"MS Word 97" sample.pdf

I don't know what is the mistake in the first command. Please help me with this. And also suggest me if I need to add any other attributes that will improve the efficiency and quality of conversion.

  • Thanks a lot for helping. But I need some command to convert the files. The post you shared is for converting the files using GUI. Cheers!
    – SuRa
    Commented Jul 16, 2020 at 15:55
  • Does this website help you? sarata.com/manpages/lowriter.1.html
    – Raffles
    Commented Jul 16, 2020 at 17:44
  • @Raffles No. They gave the list of attributes but doesn't mention what we need to use to convert pdf to word.
    – SuRa
    Commented Jul 17, 2020 at 5:14

3 Answers 3


I'm using LibreOffice for a long now but still can't understand it how does it work with different files.
I'm using the below command to convert PDF to WORD. You may try :

libreoffice --infilter="writer_pdf_import" --convert-to docx input.pdf

This is working perfectly.

  • Does not work for me. I got: Error: source file could not be loaded. I had put the full path but does not work
    – skonsoft
    Commented Mar 3, 2021 at 15:20
  • try executing the command when you are in same directory with the input.pdf Commented Mar 4, 2021 at 2:32
  • THANK YOU this works ! For me there is no option in the gui to save/convert pdf's to anything but text ----- the commandline comes to the rescue :-) Commented Oct 8, 2021 at 18:30
  • Thanks very much -- One little value add. I'm using LibreOffice from flathub. You can run: flatpak run org.libreoffice.LibreOffice --infilter="writer_pdf_import" --convert-to docx input.pdf
    – will
    Commented Sep 28, 2022 at 12:12

Did you try with soffice?

soffice --infilter="writer_pdf_import" --convert-to docx sample.pdf

As per this post: Can I convert a PDF file to a Word File? - Ask LibreOffice

No, LibreOffice will not convert a PDF to a DOC (or ODT) or so.

If your pdf is having texts and not images you can open it with LibreOffice draw and then copy and paste and edit & save document as you need.

  • 4
    It will convert. The only problem is no one shared the exact code to convert. My first command is working but with some errors. The second command is working but not efficient. All I need is some expert help
    – SuRa
    Commented Jul 16, 2020 at 15:53
  • was the OP asking about MS Word or LO Write?
    – graham
    Commented Aug 5, 2020 at 16:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .