All Projects → metaist → Pdfmerge

metaist / Pdfmerge

Licence: other
Command-line utility for merging, splicing, and rotating PDF documents.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Pdfmerge

Deerlet
[Deprecated] A markdown online-editable-resume with pdf generator
Stars: ✭ 79 (-10.23%)
Mutual labels:  pdf
Koreader Base
Base framework offering a Lua scriptable environment for creating document readers
Stars: ✭ 81 (-7.95%)
Mutual labels:  pdf
Pdfreport
PdfReport is a code first reporting engine, which is built on top of the iTextSharp and EPPlus libraries.
Stars: ✭ 85 (-3.41%)
Mutual labels:  pdf
Gotenberg Php Client
PHP client for the Gotenberg API
Stars: ✭ 80 (-9.09%)
Mutual labels:  pdf
Puppeteer Pdf
PDF generation wrapper for Elixir using Puppeteer
Stars: ✭ 82 (-6.82%)
Mutual labels:  pdf
Dicom Ecg Plot
Dicom ECG Viewer and Converter. Convert to PDF, PNG, JPG, SVG, ...
Stars: ✭ 84 (-4.55%)
Mutual labels:  pdf
Cheatsheets
JavaScript and Node.js cheatsheets
Stars: ✭ 1,191 (+1253.41%)
Mutual labels:  pdf
Simplewpfreporting
Reporting in WPF (XAML) made easy
Stars: ✭ 87 (-1.14%)
Mutual labels:  pdf
Fe Necessary Book
A book and software collection about frontend
Stars: ✭ 1,239 (+1307.95%)
Mutual labels:  pdf
Kotlin Reference Chinese
Kotlin 官方文档(参考部分)中文版
Stars: ✭ 85 (-3.41%)
Mutual labels:  pdf
Flutter plugin pdf viewer
A flutter plugin for handling PDF files. Works on both Android & iOS
Stars: ✭ 81 (-7.95%)
Mutual labels:  pdf
Word2pdf Tools
📝通过LibreOffice / WPS / Microsoft Office / 第三方库 实现多种word转pdf格式的方案
Stars: ✭ 82 (-6.82%)
Mutual labels:  pdf
Graphicsrenderer
A drop-in UIGraphicsRenderer port -- CrossPlatform, Swift 4, Image & PDF
Stars: ✭ 85 (-3.41%)
Mutual labels:  pdf
Jfbview
PDF and image viewer for the Linux framebuffer.
Stars: ✭ 78 (-11.36%)
Mutual labels:  pdf
Cube.pdf
CubePDF series and their library codes. The project is based on PDFium, iTextSharp, and Ghostscript (net35, net45).
Stars: ✭ 86 (-2.27%)
Mutual labels:  pdf
Laravel Pdf
A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
Stars: ✭ 79 (-10.23%)
Mutual labels:  pdf
React Pdf
📄 Create PDF files using React
Stars: ✭ 10,153 (+11437.5%)
Mutual labels:  pdf
Vectorgraphics2d
Graphics2D implementations to export various vector file formats
Stars: ✭ 87 (-1.14%)
Mutual labels:  pdf
Grobid
A machine learning software for extracting information from scholarly documents
Stars: ✭ 1,275 (+1348.86%)
Mutual labels:  pdf
Promises Book
JavaScript Promiseの本
Stars: ✭ 1,264 (+1336.36%)
Mutual labels:  pdf

pdfmerge Build Status

pdfmerge is a command-line utility for manipulating PDF files.

Questions & Issues

If no one has mentioned it before, let us know.

Getting Started

Install

The fastest way to install pdfmerge started is to use pip:

$ pip install pdfmerge

On Windows, you can use the Windows installer if you don't have python.

Contribute

If you want to play around with the latest code, start by cloning the repository:

$ git clone git://github.com/metaist/pdfmerge.git

Install the dependencies (specifically pyPdf) using ant or pip:

$ ant resolve
$ pip install -r requirements.txt --use-mirrors

Optionally, test the package using ant:

$ ant test

Install pdfmerge as a python library:

$ python setup.py install

All of the magic happens in pdfmerge.py.

Usage

$ pdfmerge [-h] [--version] [-o FILE|--output FILE] [-p PASSWORD|--password PASSWORD] PATH[RULE[, RULE ...]] [PATH[RULE, ...]] ...]
  • -o, --output output file (default: output.pdf). Must not be any of the input files.

  • -p, '--password` password for encrypted files (default: empty string).

  • PATH a file, directory, or wildcard string (e.g., file*.pdf) of files to merge.

  • RULE an optional string indicating which pages to extract and rotate. The syntax for each rule is:

    [START][..][END][ROTATE]
    

    Where START and END are positive (1-based) or negative page numbers and ROTATE is one of >, V, or < indicating a clockwise rotation of 90, 180, 270 degrees, respectively.

Command-line Example

$ pdfmerge -o out.pdf file1.pdf file2.pdf[3,3] file2.pdf[1V,2..-1] "other*.pdf[<]" "/path/pdf[1..4>,5]"

This example illustrates several features:

  • specifying an output file (must not be any of the input files)
  • merging multiple files, some more than once
  • splicing parts of file using indicies (1-based; negatives allowed)
  • including the same page multiple times
  • rotating a page or page range
  • merging all the PDFs in a directory

Features

Choose an output file.

Optional. Specify a path to write the result of the merge.

$ pdfmerge -o merged.py file1.py file2.py
  • The output file must not be any of the input files.
  • By default, the output file is output.pdf.
  • You may specify only one output file.

Merge one or more files.

Required. Specify one or more file PATHs using wildcards or point to a directory.

$ pdfmerge file1.pdf file2.pdf file1.pdf
$ pdfmerge file*.pdf
$ pdfmerge /path/pdf
  • You must specify at least one file.
  • You may specifying the same file multiple times.
  • Wildcards are okay (e.g., file*.pdf).
  • If you specify a directory, all of the PDFs in that directory will be included (i.e. equivalent to appending *.pdf to the path).

Use index-like notation to choose page ranges.

Optional. After each PATH, specify which parts of the file should be spliced.

$ pdfmerge file1.pdf[1] file2.pdf[2]
$ pdfmerge file*.pdf[7]
$ pdfmerge file.pdf[3..1]
$ pdfmerge "file.pdf[1..3, 7..10]"
$ pdfmerge "file.pdf[2, 1, 3]"
$ pdfmerge "file.pdf[1, 4..]"
  • If indicies are omitted, all pages are included.
  • Use commas to separate multiple ranges.
  • Whitespace is ignored (e.g., [1 .. 2, 3] is the same as [1..2,3]), but remember to enclose parameters with whitespace.
  • Indicies start at 1 (1-based), but negative indicies are okay (i.e. the first page is 1, not 0; -1 is the last page).
  • Reverse ranges are okay (e.g., [2..1] is the reverse of [1..2]).
  • Open-ended ranges are okay (e.g., [2..] and [..3]).
  • Ranges outside of bounds are quietly forced into bounds (e.g., [2..7] for a 3-page file is treated like [2..3]).

Rotate individual pages or page ranges.

Optional. After each range, use a rotator (>, V, and <) to rotate the range by 90, 180, and 270 degrees clockwise.

$ pdfmerge "file.pdf[1..3>]"
$ pdfmerge "file.pdf[1<]"
$ pdfmerge file.pdf[1..2, 4V]
$ pdfmerge "*.pdf[>]"
  • When using the < and > rotators, surround the entire string with quotes to avoid conflicts with the command-line's use of those operators.
  • The rotator is case-sensitive (i.e. it's a capital V).
  • You cannot specify more than one rotator. (Why would you want that?)
  • The rotator comes right after the range (e.g., [1>,2..3] not [1>..3]).
  • You can still specify a rotator if there's no range (e.g., [<] is the same as [1..<]).

Specify options in an external file.

Optional. You can specify some or all of the options to pdfmerge using an external file. For example, if you have a file opts.txt:

-o myoutput.pdf
file.pdf[1,3..5>]
file.pdf[2<]

You can provide it on the command line with a special @ prefix:

$ pdfmerge @opts.txt

Python Module Usage

pdfmerge can also be imported into python scripts.

import pdfmerge
pdfmerge.merge(['pdf-1.pdf', 'pdf-2.pdf[2>]'], 'output.pdf')

License

Licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].