I have PDF file.
I need to copy some text from it preserving its formatting (so I need to save italic, bold, _underline_, font sizes and colors, links).

It seems that I need to copy text from PDF as HTML or RTF (or something similar).

I tried:

  • copy text from Atril, paste to LibreOffice Writer - got plain text even if I select paste as RTF;
  • copy text from Atril, paste to Abiword - got plain text;
  • copy text from Okular, paste to LibreOffice or Abiword - got plain text;
  • converting PDF to HTML with pdf2htmlex - got HTML, but copying from web-browser makes all text plain again;
  • importing PDF to LibreOffice Impress - formatting is preserved, but copying is difficult because of large amount of text blocks.

Which software from Ubuntu 16.04 LTS repository should I use to solve my problem?

  • This is not a native solution, but opening the PDF in Google Doc may give you better results than LibreOffice. – user68186 Apr 10 '18 at 21:12

That is not possible in general. Not even with Acrobat Reader Pro. Adobe recommended saving as Word doc or HTML. Evince or Okular will allow you to copy and paste using the from the viewer in utf8 but that discards formatting, mostly.

As you said, the best bet might be to use the LibreOffice import which tries to preserve many features of pdf format that map on to odf. Also, you can use the pdftk tool to select specific pages from a larger pdf file and then import them into LibreOffice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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