Sign inSign up

northwestwitch/pdfmerger

By northwestwitch

•Updated over 2 years ago

A PDF merger based on PyPDF2 and Reportlab. Allows to preserve merged files's original names.

Image
0

2.5K

northwestwitch/pdfmerger repository overview

⁠pdfmerger

A small python package to merge and bookmark PDF files based on PyPDF2 and reportlab.

Allows to merge a list of PDF files while preserving their original name. In fact the file name of each merged file (without extension) may optionally be written on every page of the merged file (watermark).

Unless specified in the program options (--write-filenames) no watermark will be added to the pages.

Output file will contain bookmarks to the original files.

⁠Running the program using Docker

This program can be used on the fly without installation by running the image present on Docker Hub⁠

Simple command to launch the container and check that it works:

docker run -it --rm  pdfmerger --help

Keep in mind that you need to map the folder(s) containing the files to merge and the folder that will contain the outfile to a folder in the Docker container filesystem (default is /home/pdfmerger/data). To do so you should run the container providing a volume. For instance if you files are in folder /home/username/documents the volume will be /home/username/documents:/home/pdfmerger/data

Please note that the program will look your for infiles inside /home/pdfmerger/data because that is the folder that they're mapped into, so when you run the program from the terminal the --infile(-f) option should point to that folder. In the terminal, In order to produce an outfile on your file system (and outside the container) you should also provide the option --outfolder /home/pdfmerger/data.

Example command to pull the image from Docker Hub and execute the program directly with custom parameters:

docker run -d --rm \
-v /home/username/documents:/home/pdfmerger/data \
northwestwitch/pdfmerger --orientation landscape \
-f /home/pdfmerger/data/infile1.pdf -f /home/pdfmerger/data/infile2.pdf .. \
--outfolder /home/pdfmerger/data (--outfile outfilename.pdf)

⁠Usage

Options:
  -f, --infile TEXT               Path to one infile, repeat for multiple
                                  files  [required]

  --orientation [portrait|landscape]
                                  Orientation of initial PDF files  [required]
  --outfolder PATH                Path to destination outfile
  --outfile TEXT                  Name of destination outfile
  --write-filenames               Write original file names on the pages
                                  before merging
  --help                          Show this message and exit.

Tag summary

Content type

Image

Digest

sha256:535b5ea14…

Size

63.8 MB

Last updated

over 2 years ago

docker pull northwestwitch/pdfmerger