Today I was trying to convert a document in. pdf. odt and I found some interesting things.
Basically I found two ways to do this, but none achieved a 100% efficient.
The first and best choice in my opinion, is to install the program “xpdf”.
This really is a suite of tools for PDF files. Comprising: A display of documents (pdf obviously), along with a series of command line programs, for example: moving pdftotext pdf to txt, extract images with pdfimages. Or translate documents PDF to PostScript with pdftops.
And is this part that interests us here. To move from pdf to txt, is as simple as opening a terminal in the file folder and write
$ pdftotext file.pdf
This will generate a file of the same name as the pdf but in txt format. If we get a. odt directly:
$ pdftotext file.pdf archivo.odt
That’s it, but there are some drawbacks: The file should not be too complex in its text format, otherwise the converted file will be chaos, or directly will fail and we can not perform the conversion. Obviously only convert the text, if images must be extracted pdfimages.
The other solution I found is to install “KWord” which is the KOffice word editor, which brings the ability to import and save pdf files odt. The advantage of this method is to import text and images together, even for text xpdf only gave me better results.
Is up to you to prove which is more to your liking, I personally choose to xpdf, as it is a very useful tool targets only PDF files. Instead KWord is a text editor (which I have and I like that I have: Open office writer).
Ha, I forgot to install xpdf and kword:
$ sudo aptitude install xpdf
$ sudo aptitude install kword
I hope will be helpful.