Skip to content

Partially edit PDFs with a graphical user interface: (logical) page numbers, outline, crop

License

Notifications You must be signed in to change notification settings

oliviercailloux/PDF-p

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF-p

Overview

This program permits to edit the following information in a PDF:

  • logical page numbers (to make them correspond to printed page numbers)

  • outline

  • crop box

The logical page number and outline are visible in most PDF viewers (example here) and make navigation handy. The crop box is useful to resize the page, for example to get rid of white space. (Very useful for e-reader devices with limited screen space.)

Please note the following disclaimers.

  • A PDF may contain complex outline information. This program is only able to manage simple outline information: outline entries which link to a given page. When editing your PDFs with this program, only the simple outline information is saved, thus possibly resulting in loss of information for some PDFs.

  • Cropping your PDF does not remove any information, it simply hides it. It is not suitable for removing confidential information or for reducing the file size. (The good point about this strategy is that it is easy to undo, even if your original PDF has been lost: just change the crop box again.)

Install and run

You need a recent JRE to run the software (Java SE 8 or higher). See here (or check with your package manager on your system). My advice: make sure you have only one recent JRE installed on your system and no JDK (unless you are a Java developer). (Issues generally come from conflicting information stored in the system. If you have several JREs or JDKs, uninstall them all and install only one JRE.)

To “install” (no proper installation is actually needed) and run this software:

  • Download the appropriate release file

  • Expand in the folder of your choice

  • Double-click the main jar file

    • Alternatively, run: java -jar pdf-p.jar

User documentation

  • To add entries, use the keyboard + key.

  • To remove entries, select them and press the delete key.

  • In the outline pane, to shift entries (make them children of other entries), select them and use the keyboard right arrow key (or left arrow key to restore).

  • To crop, enter numbers in the four boxes.

I have tested the software in Linux only.

Please report any issues on this web site.

Technical documentation

Log

In case of problems: here is how to change the log verbosity. (See also Logback manual.)

  • Download a sample Logback configuration file here.

  • (Optional) Tweak it according to your needs, e.g. change the log levels.

  • Start the application with the system property logback.configurationFile pointing to the file. (You must give the full path, otherwise Logback considers the pointer as a classpath resource path.)

    • Example: java "-Dlogback.configurationFile=/home/…/logback.xml" -jar …/pdf-number-pages.jar.

  • You may also add "-Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener" to see where Logback looks for configuration instructions.

Obtain bounding boxes

Here is how to obtain current bounding boxes in a PDF file (tested under Linux).

gs -sDEVICE=bbox -dBATCH -dNOPAUSE -c save pop -f InputFile.pdf

Sample output: %%BoundingBox: 161 519 380 594.

pdfinfo -box InputFile.pdf

Sample output:

Page size:      439.37 x 666.142 pts
MediaBox:           0.00     0.00   439.37   666.14
CropBox:            0.00     0.00   439.37   666.14
BleedBox:           0.00     0.00   439.37   666.14
TrimBox:            0.00     0.00   439.37   666.14
ArtBox:             0.00     0.00   439.37   666.14

Quit program

When opening a pdf viewer instance from this software, then closing this software’s main window, this software process stays in memory until the viewer is closed as well. This is probably due to the viewer being a child process of this software. I don’t know how to avoid this effect. Write to me if you know more. (Observed on my Linux system. Please tell me about other systems.)

Credits

Icon made by Freepik from www.flaticon.com.

About

Partially edit PDFs with a graphical user interface: (logical) page numbers, outline, crop

Resources

License

Stars

Watchers

Forks

Packages

No packages published