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-2122Merge PDF Documents or Collate PDF Page Scans2324-2526Split PDF Pages into a New Document2728-2930Rotate PDF Documents or Pages3132-3334Decrypt Input as Necessary (Password Required)3536-3738Encrypt Output as Desired3940-4142Fill PDF Forms with X/FDF Data and/or Flatten Forms4344-4546Generate FDF Data Stencils from PDF Forms4748-4950Apply a Background Watermark or a Foreground Stamp5152-5354Report PDF Metrics, Bookmarks and Metadata5556-5758Add/Update PDF Bookmarks or Metadata5960-6162Attach Files to PDF Pages or the PDF Document6364-6566Unpack PDF Attachments6768-6970Burst a PDF Document into Single Pages7172-7374Uncompress and Re-Compress Page Streams7576-7778Repair Corrupted PDF (Where Possible)7980PDFtk Server does not require Adobe Acrobat or Reader, and it runs on Windows, Mac OS X and Linux.8182So 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:8384pdftk A=odd_pages.pdf B=even_pages.pdf shuffle A Bend-1 output collated_pages.pdf8586if the even pages are in normal order, it's even easier:8788pdftk A=odd_pages.pdf B=even_pages.pdf shuffle A B output collated_pages.pdf8990**Question: Does anyone out there know if there is a python library for PDFTK (or equivalent)?**9192**References:** https://www.pdflabs.com/blog/how-to-collate-even-odd-scanned-pages/ https://www.pdflabs.com/tools/pdftk-server/939495