Giter Site home page Giter Site logo

pdf_shuffer's Introduction

I have many colorful PDF files to print. Printers don't work well:
1. The pages size and orientation vary. However printers auto-adjust all pages per the ratio calculated from the 1st page.
2. Colorful printing is somewhat expensive. I want to delete some meanless pages.
3. Some files consist of several sections. I want to ensure the first page of a section don't mix with the last page of the previous section.
4. Some pdf pages consist of two physical pages, others consist of only one. I want the same font size when printing.

I have no budget for commercial PDF editors, so comes this script. I use it to process PDF files, and then print them directly, a.k.a disabling all paper auto-adjustment options of printer such as page scale, auto center and etc.

This script is based on following utils:
pdftk		http://www.pdflabs.com/. PDFtk is a command-line tool to merge/split/rotate/burst pdf.
pdfinfo		a tool inside poppler-utils.
pdfjam		http://go.warwick.ac.uk/pdfjam, http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/pdfjam. PDFjam is a small collection of shell scripts which provide a simple interface to much of the functionality of the excellent pdfpages PDF file package. The main script is named "pdfjam". All of the other scripts are simple wrappers for calls to pdfjam. For example, pdfbook, pdf90, and etc.
gs		Ghostscript (PostScript and PDF language interpreter and previewer). man 7 gs.

These depencency can be installed as following on Linux Mint 15+:
$ sudo apt-get install pdfjam texlive-latex-base texlive-latex-recommended pdftk poppler-utils ghostscript 

As following are some examples. The original and processed PDF files are at the examples directory. 
zhichyu@jupiter:~$ pdf_shuffer.py -o processed original/57-0\ red\ book.pdf
type "help" for help, "quit" or "exit" to quit
[op exp] split n@2-16
[op exp] join 2*n+1
[op exp] resize a4paper
[op exp] quit
zhichyu@jupiter:~$ pdf_shuffer.py -o processed original/77-0\ Knuffle\ bunny.pdf
type "help" for help, "quit" or "exit" to quit
[op exp] join n@3,5,8,10,12,14,16,18,21,23,25,27
[op exp] add 2:1,18:1
[op exp] join 1,18
[op exp] rotate 1,2,5,12,17       
[op exp] resize a4paper
[op exp] quit
zhichyu@jupiter:~$ pdf_shuffer.py -o processed original/97\ george\ and\ martha.pdf     
type "help" for help, "quit" or "exit" to quit
[op exp] add 2:1,7:1,11:1,15:1,19:1
[op exp] join 1,7,12,17,22
[op exp] resize a4paper
[op exp] quit
zhichyu@jupiter:~$ pdf_shuffer.py -o processed original/Go\,Dog.Go\!.pdf    
type "help" for help, "quit" or "exit" to quit
[op exp] delete 2,24
[op exp] join 2*n+1
[op exp] resize a4paper
[op exp] quit
zhichyu@jupiter:~$ pdf_shuffer.py -o processed original/How\ Do\ Dinosaurs\ Say\ Good\ Night.pdf 
type "help" for help, "quit" or "exit" to quit
[op exp] move 21:2
[op exp] join 1
[op exp] resize a4paper
[op exp] quit

pdf_shuffer's People

Contributors

yuzhichang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.