1

I sometimes have to read large-ish PDF documents (up to hundreds of pages) of technical documentation. Often parts of the documentation don't apply to the problem I'm solving, others apply and are quickly made use of, yet others have to be "considered later". This poses the problem of having a large document of which only a part is relevant, and that part usually only shrinks.

While on MacOS X, I developed the tactic of viewing the PDF in Preview, removing pages that are not / no longer relevant. I'm now doing that with PDF Arranger, which is not entirely convenient since I have to switch to a different application, but at least it's something.

I also used to use Preview's annotation feature to overlay a white rectangle over parts of a page that are no longer relevant, when other parts of the same page are still relevant.

Is there any tool to do the same on Ubuntu?

(I explained the context to emphasize that I do not need general PDF editing and instead want to remove parts quickly while reading.)

  • 1
    Have you tried LibreOffice Draw? https://askubuntu.com/questions/167274/how-can-i-edit-a-picture-into-an-existing-pdf-file/99856#99856 – C.S.Cameron Jan 09 '21 at 09:11
  • LO Draw seems to work when it works, but chokes on larger documents (frequently locks up the UI for more than a minute), while opening the PDF in a simple reader application works flawlessly. It's not exactly clear to me what the intended use case for LO Draw is (full editing for PDFs with few pages? But it even corrupts the layout when loading a PDF...), but my case doesn't seem to match. Still, if I don't find anything better, it's at least one more tool to have. – Martin Geisse Jan 09 '21 at 10:03
  • It seems that in practice, splitting a heavyweight document with PDF arranger into "sections", then editing with LO draw works fine, so your comment actually helped me a lot. Unfortunately I can't upvote comments. – Martin Geisse Jan 10 '21 at 10:55

2 Answers2

1

In OSX's Preview.app the build in "crop-function" would be the best choice to delete unwanted user defined parts of a single page. Alternatively you could select one or more pages and delete them all together.

In Ubuntu there are similar applications that offer these options as well: I use and prefer PDF-Shuffler for PDF Merging, Rearranging, Splitting, Rotating and Cropping.

  1. Simply install by using Ubuntu Software Center
  2. Open your pdf-file of choice, select your unwanted pages and delete them and/or use the "edit -> crop-option".
  3. Save your modified pdf-file.

enter image description here enter image description here

I deleted Page2/3/4 and cropped approx. 50% of Page 5/6 for a visual example in a few seconds.

v2r
  • 9,547
0

Suppose you have a pdf like this. Ubuntu Server Guide

You can open a terminal by pressing Ctrl+Alt+T on your keyboard.

cd ~/Downloads/
wget -c 'https://help.ubuntu.com/18.04/serverguide/serverguide.pdf'

get pages from 3 to 50 from pdf into serverguide.txt

pdftotext -layout -nodiag -f 3 -l 50 -nopgbrk ./serverguide.pdf

Then suppose you want to extract lines 3 to 8

echo -e "\n\n\n" >> mySmallerTxt.txt sed -n '3,8p' serverguide.txt >> mySmallerTxt.txt echo -e "\n\n\n" >> mySmallerTxt.txt

And also lines 33 to 55

echo -e "\n\n\n" >> mySmallerTxt.txt sed -n '33,55p' serverguide.txt >> mySmallerTxt.txt echo -e "\n\n\n" >> mySmallerTxt.txt

To find line numbers of interest you can

cat -n serverguide.txt|less