How to convert pdf to word from terminal?

Hi,
How i can convert pdf file to word using terminal command in ubuntu 18.06 without gui installed ?

This is impossible.

Why? If it’s possible to convert a text document to pdf libreoffice --headless --convert-to pdf test.docx --outdir /pdf I think the other way around is also possible, but i can’t find the right command

1 Like

@IreneGLopez: PDF is a page description format (a kind of graphical representation) where all text-processing relevant information has been stripped off. You end up with sequences of characters (not necessarily full lines) which are (x,y)-positioned on each page and possibly not even in text order! The removed information cannot be recreated, notably styling.

2 Likes

Converting PDF back into some document format would be like pushing toothpaste back into the tube. PDF is a print-out to file. You can create PDF from anything that can be printed, Design software, any drawing program, any writing program, spreadsheets, thousands of different applications can print to paper and PDF as well. The PDF does not even contain any information about the software that produced this print-out. PDF is about lines, shapes and characters on virtual paper. There are no paragraphs, no headers, no footers, no page numbers nor any other functional elements in a PDF. Only lines, shapes and characters at precise positions. This is why LibreOffice always loads PDF into the Draw component. Draw deals with lines, shapes and characters on virtual paper sheets.

2 Likes

Hey,
I know the document template will be broken and I will only get the text from the file, but this doesn’t answer my question anyway. It’s easy to convert from pdf to word in Microsoft Word, and I’m pretty sure there will be a command for libreoffice as well.

(I totally support everything others said about the conversion; but at the same time, I suppose that trying to think for the asking user is wrong to the same extent as expecting software to think for user too much. Just test and judge yourself.)

1 Like

I don’t think so, but if you only need the text you may check this article:

pdftotext -layout could be something to try. Otherwise google for pdf2txt to get more suggestions.