11

I have a PDF file which I want to edit in LibreOffice Draw/Writer without corrupting it. Is there any way I can do it?

I have already installed the LibreOffice pdfimport plugin, yet the PDF file is getting corrupted with it. I just want to add an image in the PDF file after opening it with LibreOffice. I have been searching for how to do this for the last 4 hours and I am not able to find a way.

If it is not possible with Libreoffice, which software should I use in Ubuntu to add images in PDF files without losing their letter recognition capabilities?

Edit: I was trying to fill an application form, that's why I needed to edit the pdf file.

UJM
  • 224

3 Answers3

14

PDF is not designed to be an editable format.

  • Importing in LibreOffice Impress causes the PDF objects to be converted to LO objects that match as best as possible. This inevitably leads to changes because of incomplete mapping and conversion between the objects in these fundamentally different file formats. These changes may be less or more disrupting depending on the PDF.
  • Importing in Gimp caused the PDF to be rendered in bitmap format. The looks are exactly the same, but an exported PDF will contain bitmap information. If vector objects were present in the original PDF, these will be lost.

Perhaps Xournal++ will suit your needs. You can add text, annotations and images to an existing PDF. The added content will be included as an additional layer, without changing the initial PDF data in any way.

Another way to add objects to an existing PDF would be to use command line tools. For example, pdftk with its stamp option allows to superimpose one PDF on another, useful for example to add page numbers, or eventually a graphic.

It is preferred, however, where possible, to work with source documents in the appropriate format for editing, and export the final version to PDF.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
vanadium
  • 88,010
  • Thank you for your quick and kind answer. I am able to do it in Xournal. – UJM Jul 12 '21 at 08:48
  • 1
    PDF is not designed to be an editable format. I'm curious, is there a source for this claim? I edit PDF files all the time without difficulty, but perhaps I'm doing things beyond what the creators of PDF ever imagined. Granted, learning how to do this was not trivial. – End Anti-Semitic Hate Jul 13 '21 at 06:55
  • 2
    PDF is not designed to be an editable format. Absolutely not true. The PDF specification itself (in PDF format itself, naturally...) has this warning (bolding mine): "... this file can be printed or viewed but shall not be edited..." and also states, on page vii (again, bolding mine) "PDF ... fulfills a set of requirements ... including ... collaborative editing of documents..." LibreOffice is botching the editing. – Andrew Henle Jul 13 '21 at 12:08
  • I often find that after importing a PDF into Libre Office the text overflows outside the page margins and is unreadable. I presume this may be some sort of font replacement issue but not sure how to address it. I've found out how to modify the styles to reduce the font size but I can't find how to re-apply those style changes to the whole document. A quick and easy solution is to use an on-line PDF editor. https://www.sejda.com/pdf-editor seems to be able to load and edit PDFs flawlessly which LO can't. – NeilG Aug 13 '22 at 06:39
  • Wow, stop press, Sejda has a free desktop app (limitations compared to paid version) with a deb Linux installer! Hooray, no more LO PDF editing problems (sad tho') https://www.sejda.com/desktop – NeilG Aug 13 '22 at 06:46
3

If you asked your question today is it safe to assume that you installed LibreOffice 7?

In any case you can just open the LibreOffice main launcher (from which you can create a document, spreadsheet, Drawing, or whatever, or, open a file.

Forget any import plugins. Just open any pdf file and LibreOffice will open it in Draw. Your pdf file will open. You can change text, add images and crop and/or size the images, move stuff around with no problem.

I'm not sure what you mean about "corrupting" your file. I suggest that as soon as you open your pdf file with LibreOffice you do immediately a "File Save as" and add a suffix to the file name such as " rev 1" or today's date.

This functionality has been around in LibreOffice for many versions now.

Vanadium's suggestions of using Xournal++ or Gimp are good, however I have found Xournal++ is quite limited and, for example, can only open files of a certain size, last time I used it. Now Gimp, on the other hand, is a VERY powerful and sophisticated tool, and you may find it has a significant learning curve.

IMHO LibreOffice is the best middle-of-the-road choice as it's powerful and quite intuitive to use.

Now there are many pdf editing programs available for Linux, here's one list mentioning some of the items above:

13 Best PDF editors for Linux

I have purchased Master pdf Editor and have used it for several months now and it works very well including Digital Signature Certificates.

I'm considering purchasing Quoppa for better security.

N0rbert
  • 99,918
xian555
  • 65
  • 1
    thanks for your detailed answer. I am using the LibreOffice version 6.4.7.2 and my word "corrupt" meant letters get garbled/misplaced on the page or the layout of the page gets changed. Now it has been solved! – UJM Jul 13 '21 at 07:48
3

which software should I use in Ubuntu to add images in PDF files?

Xournal

xournal screenshot

I've used it for years to sign documents using a transparent png and fill in fields. It's a little clunky, maybe, but it works very well. I think it was intended for use on tablets with a stylus to make drawings, but it supports "PDF Annotation" as well.

PDF Annotater is the category of software you want. There's probably other PDF Annotaters out there but Xournal works great! "PDF Editor" or how to edit PDFs will get you the sort of answers like "you shouldn't edit pdfs"

It's true that editing a PDF is kludgy and error prone, but its certainly not impossible. Usually, annotating is good enough. You can even mask areas with a white rectangle and provide different words or graphics. Just be aware that the original data is all still there, and often easily uncovered. It's fine though if you're the only one using the resultant PDFs.