1---2title: 'PDFTK - what a great tool!'3date: '2015-01-19'4published_at: '2015-01-19T08:06:00.001+11:00'5tags: ['commands', 'pdf', 'pdftk']6author: 'Gavin Jackson'7excerpt: 'During the last week I have had to use a PDF manipulation tool called PDFTK. The first instance was to strip or replace pdf metadata (for work) and the second was to collate scanned pages from my prin...'8updated_at: '2015-01-19T08:06:09.637+11:00'9legacy_url: 'http://www.gavinj.net/2015/01/pdftk-what-great-tool.html'10---1112[](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuCnSwgKTUHV9D_iO7GveYe84VVLu0xs1dM4_CfBdvpwazEjr57gw5B47dVBBWAL4eI2zi7RtnvA5edfh9prbL1ehMVAc3UjixYggwxKRcR56Vitsk01IePl9V2sW_n77lNuEJ7VNS3io/s1600/pdftk3.jpg)1314During the last week I have had to use a PDF manipulation tool called PDFTK. The first instance was to strip or replace pdf metadata (for work) and the second was to collate scanned pages from my printer at home - it even supports the even pages in reverse format!1516My wife and I are trying to create a virtual filing system in Evernote.1718(From their website) PDFtk Server can:1920- Merge PDF Documents or Collate PDF Page Scans21- Split PDF Pages into a New Document22- Rotate PDF Documents or Pages23- Decrypt Input as Necessary (Password Required)24- Encrypt Output as Desired25- Fill PDF Forms with X/FDF Data and/or Flatten Forms26- Generate FDF Data Stencils from PDF Forms27- Apply a Background Watermark or a Foreground Stamp28- Report PDF Metrics, Bookmarks and Metadata29- Add/Update PDF Bookmarks or Metadata30- Attach Files to PDF Pages or the PDF Document31- Unpack PDF Attachments32- Burst a PDF Document into Single Pages33- Uncompress and Re-Compress Page Streams34- Repair Corrupted PDF (Where Possible)3536PDFtk Server does not require Adobe Acrobat or Reader, and it runs on Windows, Mac OS X and Linux.3738So I have a pretty standard scanner (an EPSON Artisan 837), it has a document feeder but only scans one side at a time, so when you run it through the first time you have odd pages, turn the bundle over, scan it and you have a bundle of even pages (in reverse order). This simple command collates them:3940pdftk A=odd_pages.pdf B=even_pages.pdf shuffle A Bend-1 output collated_pages.pdf4142if the even pages are in normal order, it's even easier:4344pdftk A=odd_pages.pdf B=even_pages.pdf shuffle A B output collated_pages.pdf4546**Question: Does anyone out there know if there is a python library for PDFTK (or equivalent)?**4748**References:** https://www.pdflabs.com/blog/how-to-collate-even-odd-scanned-pages/ https://www.pdflabs.com/tools/pdftk-server/495051