Skip to content

kylewhite/stapler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

---------
 Stapler 
---------

 * History *
Stapler is a pure python replacement for PDFtk, a tool for manipulating PDF 
documents from the command line. PDFtk was written in Java, and natively 
compiled with gcj. And it has been discontinued a few years ago and bitrot is 
setting in (i.e. it does not compile anymore in archlinux).
Since I used it quite a lot, I decided to look for an alternative and found 
pypdf, a PDF library written in pure Python. I couldn't find a tool which 
actually uses the library, so I started writing my own.
At some point I plan on providing a GUI, but the command line version will 
always exist. 

 * License *
A simplified BSD Style license describes the terms under which Stapler is 
distributed. A copy of the BSD Style License used is found in the file "LICENSE"

 * Usage *
I am too lazy at the moment to learn how to create a proper man page so this has
to suffice.

There are 4 modes in Stapler:
 - cat:
	Works like the normal unix utility "cat", meaning it con_cat_enates files.	
	The syntax is delightfully simple:
	
		stapler cat input1 [input2, input3, ...] output
		# example:
		stapler cat a.pdf b.pdf c.pdf output.pdf
		# this would append "b.pdf" and "c.pdf" to "a.pdf" and write the whole  
		# thing to "output.pdf"
	
	you can specify as many input files as you want, it always cats all but the
	last file specified and writes the whole thing into the last file specified

 - split:
	Splits the specified pdf files into their single pages and writes each page
	into it's own pdf file with this naming scheme: 
	
		${origname}p${zeropaddedpagenr}.pdf
		
	Syntax:
		stapler split input1 [input2 input3 ...]
		
	Example for a file foobar.pdf with 20 pages:
	
		$ stapler split foobar.pdf
		$ ls
			foobarp01.pdf foobarp02.pdf ... foobarp19.pdf foobarp20.pdf
	
	Multiple files can be specified, they will be processed as if you called 
	single instances of stapler.

 - select/delete (called with sel and del respectively)
	These are the most sophisticated modes. With select you can cherrypick pages
	out of pdfs and concatenate them into a new pdf file.
	
	Syntax:
		stapler sel input1 page_or_range [page_or_range ...] [input2 p_o_r ...] 
	Example:
		stapler sel a.pdf 1 4-8 20-40 b.pdf 1-5 output.pdf
		# this generates a pdf called output.pdf with the following pages:
		# 1, 4-8, 20-40 from a.pdf, 1-5 from b.pdf in this order
	
	What you _cannot_ do yet is not specifying any ranges. I will probably merge
	select and cat so that you can specify pages and ranges, but if you don't, 
	it just uses the whole file.
	
	The delete command works almost exactly the same as select, but inverse.
	It cherrypicks the pages and ranges which you _didn't_ specify out of the 
	pdfs.



contact me if you have questions about usage or anything, really :)
2009, Philip Stark (heller <dot> barde <at> gmail <dot> com)

About

A small utility making use of the pypdf library to provide a (somewhat) lighter alternative to pdftk

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published