Linux edit pdf text

How to Edit PDFs?

I typically have two needs: Scenario A. Change a single PDF page. In this case I have a PDF but not the original source file used to create the PDF. I don’t want to try to recreate the document from scratch. I’d like to open the PDF and change a few things. A good example of this scenario: I was responsible for planning a big event at a campground site, I had a PDF of the site. I wanted to start with that document, highlight some parts, add some labels, remove some parts that weren’t relevant. or Scenario B. Combine PDFs or extract page(s) from a PDF This scenario usually arises because I want a single PDF deliverable that is made up of parts that are best created in different programs. In this case I have the source files for all the documents but they don’t play well enough together to easily create a single PDF deliverable. For part of it, I may want to use Libre Office Writer. For another page I may want to use Gimp. Still another page I may use Libre Office Calc. I could use Writer as the master document and embed images or the Calc object into that, but for ultimate control, you can’t beat separate PDF documents that are then combined. What are the best tools / processes for editing PDFs in Ubuntu?

Care to add your answer to here: askubuntu.com/questions/72920/… and flag this for closure as a dupe of the first? You can also edit the title and the question a tiny bit on the other side. That will make things more consistence and make sure that the information is located on one place.

15 Answers 15

LibreOffice Draw

sudo apt-get install libreoffice libreoffice my.pdf 

Just open the PDF, edit, and export as PDF.

The editing tools appear in a toolbar at the bottom of the window (took me some time to find it. )

Relevant feature set I have found so far (Ubuntu 13.04, LibreOffice 4.0.2.2):

  • Remove pages: Right click on the page on the left page list > Delete page. See also: How can I extract a page range / a part of a PDF?
  • Change page order: Drag drop pages on the page list
  • Edit existing text fields (edit text, formatting and position). Just click twice with the select tool to enter edit mode.
  • Add new text fields. Choose the text tool at the bottom (T), select the desired text area, and write.
  • Edit non text fields objects like lines or bullets.
  • Create fillable PDF forms (Enable the Form* toolbars and be sure to select «Create a PDF Form»)
Читайте также:  Настройка терминала linux ubuntu

I could not find an extremely convenient highlight method, but you could get away with editing text attributes like setting the colour red and boldface. I could not change the background colour tough.

If I missed good features, please edit and add them!

enter image description here

Of course, as you can see in the screenshot above, PDFs don’t have as much information as the original ODT, and e.g. I can only edit one visible line at a time of a paragraph, and the following paragraphs won’t «wrap back» to the correct size, since PDFs simply aren’t designed to be editable.

Note: I know that it fails for a few type of PDFs, it has already happened to me.

If that is the case for you, please open a minimal, super detailed and reproducible bug report on their bug tracker https://bugs.documentfoundation.org/ so that devs may solve it, and post the link as a comment. When it happened to me I was lazy/inexperienced and didn’t do that 🙂

Despite this, it was still the best open solution when I last checked, and it works most of the time.

For «scenario A», LibreOffice pdf-importer (you might have to install it separately if have the Ubuntu pre-installed or the PPA), and for «scenario B» pdftk is the simplest (yet very powerful). Alternatively, for «scenario A» Inkscape in some cases.

If you are not installing the Community-provided LibreOffice (i.e., from libreoffice.org), you must do sudo apt-get install libreoffice-pdfimport .

LibreOffice Draw does not work for me as the fonts get completely messed up which then throws the formatting of the document off.

Here are three solutions that for me have worked consistently over the years.

PDF-shuffler

I do a lot of combining of PDF documents (as in the Scenario B) and I find PDF-shuffler simple and convenient. I have also used it to extract pages out of a larger pdf document and it works well there too. The PDF-shuffler GUI is simple and it works consistently.

Gimp

Sometimes for Scenario A you just want to convert the PDF into an image and then manipulate the image. If you don’t know the difference between a vector graphic and an image, you probably want to convert to an image and GIMP does a good job of that. When you open a PDF with GIMP it will give you some choices about how you want to convert it. Pay attention to the resolution option. Choose a higher number for a larger file size and a more detailed image.

Inkscape

The truth is, there isn’t a super easy way to edit PDF files following scenario A above. That is because PDF is a universal format and some of the structure of the document is lost when it is converted to PDF. A simple example: if you take a 3 page report and convert it to a PDF you have broken the links between the text on each page. If you edit the PDF version of it and delete a paragraph on the first page the text from pages 2 and 3 won’t automatically flow onto the first page. It would be much easier to edit that document in the original program used to create it.

Читайте также:  Linux телевизор через wifi

But for whatever reason, you don’t have the original document so you are stuck working off of a PDF. So set your expectations appropriately when editing a PDF document following scenario A.

Once you set your expectations accordingly, you’ll see that inkscape is the best tool for most jobs here. It will allow you to import a single page of the PDF document as an inkscape vector graphic. There will be a few things grouped together that don’t really make sense, and you may have to change some fonts (assuming you don’t have the original fonts installed), but really it is slick.

There is a learning curve to Inkscape but the truth is that you can’t manipulate PDF without using some program with a learning curve. For my time, I’d prefer to invest that in learning Inkscape—a great application for creating vector graphics that can come in handy for lots of different scenarios—than I would in trying to figure out how to use a special tool just for editing PDFs.

Источник

How To Edit PDF Files In Linux In The Easiest Way Possible

Sometimes you run up in a situation when you need to edit a PDF file in Linux. Like the other day, I was going through an old report which was in PDF format and I saw some typos in it. I was like, I should edit this report but I just had the PDF file. Question arises, how to edit PDF files in Ubuntu?

Now, I remembered that few years ago I used a program called pdfedit but it’s not available in Ubuntu or in any other Linux distributions anymore.

Does demise of pdfedit mean that you cannot modify PDFs in Linux?

Times have changed now. Earlier you needed to have a dedicated application for this purpose. Don’t get me wrong, there are still plenty of tools to edit PDF files in Linux, but you don’t really need them, well not in most of the cases because LibreOffice does the job for you.

Surprised? Yes, the popular Linux alternative to Microsoft Office can also edit PDF files. And perhaps this is the easiest way for editing PDF files.

How to edit PDF Files in Linux

Most of the Linux distributions such as Ubuntu, Linux Mint, Fedora etc has LibreOffice as default office suite. If you do not have LibreOffice, install it from the link below:

Читайте также:  Linux scp with ssh key

Once you have downloaded and installed LibreOffice, start it. On the welcome screen, click on Open File to open the desired PDF file to edit.

Open PDF files in LibreOffice

LibreOffice will take some time to load the PDF file. The file will be opened in Draw, part of the suite that manages graphics. Once loaded, you can immediately see that the file is in editable mode. You can also see that it recognizes the table of contents very well. Of course it depends on the original PDF file if it had a table of content or not.

editable PDF files in Ubuntu Linux

You can go to the specific pages and edit the PDF file there. Just click on the text which you want to edit.

editing PDF files in Ubuntu

Once you are done with the edits, instead of saving the file (using Ctrl+S) option, click on Export to PDF button.

Save modified PDF

It will export the file as PDF again. Note that even after exporting the changed file as PDF, it will still ask you to save the file when you try to close LibreOffice Draw. No need to tell you that you don’t need to save it anymore. The reason is that if you try to save it, instead of exporting it to PDF, it will only give you option to save it as open graphics formats. which I presume is not what you want it to be.

don

I also noticed that the edited PDF was smaller in size in comparison to the original one. It saved 1.6 MB file in 1.4 MB file. Needless to mention that you can edit the just edited PDF file as many times as you want.

Limitations of editing PDF files with LibreOffice

LibreOffice can also merge multiple PDF files among other PDF editing tasks.

I tried to edit files in few other formats such as ePub. But unfortunately, it did not work the same. Also, this PDF editing won’t work on scanned documents. So the files which were created as text and saved as PDF can be edited very easily but it’s not true in the case when you have scanned document because those pages are actually images and would need tools that could apply optical character recognition. But you won’t get that with LibreOffice.

I hope this tool helped you to modify PDF files in the easiest way possible. Have you managed to edit PDF files in Linux earlier? Which tool did you use? How does it compare to LibreOffice Draw? Do share your views.

Источник

Оцените статью
Adblock
detector