13

Some websites offer conversion of PDFs int DOCX or ODT files; and I think Adobe Acrobat (at least the full version) offers an export functionality to all sorts of formats. But in LibreOffice, if I open a PDF files, it opens in Draw. Now, Draw is fine sometimes, not always.

So, can I somehow open PDF files into an LO Writer document?

Note: I'm obviously interested in PDFs which can be legitimately perceived as Writer documents, e.g. having been exported from a word processor. Thus opening them as dozens of frames scattered across the page is not what I'm after. That can be achieved with opening in Draw, copying everything and pasting in Writer. I want the text in nice consecutive paragraphs, hopefully with consistent styles (even if synthesized) etc.

7
  • Apparently, there is no direct way to open a PDF document in Writer, nor to save it in ODT format from Draw. However, there are numerous tools for conversion of PDF to ODT documents, both online and as discrete applications. That said, conversion is always "iffy" because PDF is a page description format, losing the line breaks of the original document. Oct 16, 2017 at 22:24
  • @DrMoishePippik: But often the PDF is the output of a conversion/print-out of a document, which you then want to work on. See my edit of the question. Also, do you suggest I ask on SR.SX?
    – einpoklum
    Oct 16, 2017 at 22:38
  • The fact you're using LibreOffice may make this moot or awkward, but Word 2016 can both open and convert PDF files AND save files to ODT. Oct 16, 2017 at 22:51
  • In the conversion from ODT to PDF much is (intentionally) lost. The PDF file, for example, may lose all the original CR/LF (paragraph symbols), and add its own line breaks at the end of each line of text in the PDF document as displayed, rather than at the end of a paragraph. Oct 16, 2017 at 22:54
  • @DrMoishePippik: Most of that can rather easily be recovered, and online tools do this. Also, PDFs can include meta-data so practically none of this stuff is lost (but I'm not sure what LibreOffice saves).
    – einpoklum
    Oct 16, 2017 at 23:15

2 Answers 2

6

LibreOffice does not have the native capability to open or import random PDF files into a Writer document (and there are no extensions available that add this). As you noted, it can import into Draw and then save as ODT, but the results leave a lot to be desired. Some years ago, there was a PDF Importer extension, and that was included by default starting around version 4; it's what now lets you open a PDF in Draw and handles hybrid PDFs.

If you are creating the PDF yourself, you can export it from Writer as a "hybrid" PDF. This embeds an ODT copy of the document within the PDF. In that case, the PDF can be opened and edited in Writer and all of the formatting is preserved. Hybrid PDFs are described here: https://wiki.documentfoundation.org/Faq/Writer/PDF_Hybrid.

Otherwise, there are third-party applications and web services that will convert the PDF to ODT, which you can then open in Writer. Here are a few:

  • Online2PDF, CloudConvert, Zamzar, and file-converter-online all convert to and from PDF for a range of formats, including ODT.

  • Convertio also includes the ability to run OCR on a PDF image file to recover the document and formatting.

  • Sejda and Smallpdf don't convert to ODT, but they can convert to MS Office formats, which LibreOffice can open and use.

I have not used all of these services and it's been ages since I used any of them, so I can't advise you on how well any of the services perform. I suspect that different services may do better on documents with different characteristics, so you might want to experiment with several services to see which does the best job on your document.

There are also some downloadable conversion applications, some free, some free to try on a limited basis, and some paid. I haven't used any so I can't offer advice, but the options are easily found with a Google search.

5
  • So, you're saying the code behind these tools is proprietary, or at least - not part of the LO codebase?
    – einpoklum
    Oct 17, 2017 at 7:39
  • @einpoklum, I'm not sure of the reason why that's not a feature, like it is in MS Office. But as far as I can tell, none of the major open source, free office suites offers it. WPS Office includes a PDF to MS Office conversion in their premium product, but not their free version.
    – fixer1234
    Oct 17, 2017 at 7:55
  • Just for the records, in addition to embedding pdfimport (which is based on xpdf/Poppler), LO is now also using PDFium.
    – mirh
    Feb 24, 2019 at 2:08
  • @mirh: How is that relevant to the answer though?
    – einpoklum
    Aug 11, 2019 at 15:30
  • It was more relevant to your comment. Put aside their FOSS status, which they certainly are, whether they could count as "part of the codebase" or not kind of depends on your definition of it.
    – mirh
    Aug 12, 2019 at 12:20
6

Well, apparently - you can indeed open PDF files in Writer! LibreOffice has two separate input filters for PDFs, which open them in LO Writer and in Impress/Draw. To open a PDF file in Writer:

  1. Start Writer
  2. Choose File | Open on the menu
  3. In the file type drop-down box in the dialog, select "PDF - Portable Document Format (Writer) (*.pdf)"
  4. Locate your PDF file and select it for opening

enter image description here When you open a PDF file, you just have to make sure and scroll down the list of possible filters and choose the right one.

I've recently opened this LibreOffice bug for having each app default to using its own PDF import filter.

Caveat: The quality of PDF import leaves much to be desired. For example, at the moment, paragraphs are all broken up into separate drawing objects for each line.

3
  • @krubo Please see this post
    – JohnSUN
    Aug 10, 2022 at 8:27
  • Old thread, and I got excited when I saw your answer that LO Writer now has built-in PDF handling. I tested it on a document that had been saved as a PDF using the CUPS PDF print utility. LO Writer opened it as an editable document, but the spacing was a mess. Looks like they're not quite there, yet. Maybe quality depends on the document and the original conversion.
    – fixer1234
    Feb 24 at 15:13
  • @fixer1234: It's had it for a while. However, like you said - the quality of the import is underwhelming. It doesn't depend on the original conversion to PDF - unless you saved the PDF in a special format which also includes an ODF...
    – einpoklum
    Feb 24 at 15:46

Your Answer

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

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