Friday, April 25, 2014

PDFTK, the Swiss army knife for managing PDFs

Merging and splitting of PDF documents and pages is something that I do quite regularly; for myself and for others who reach out to me to do my ninja thing with their PDFs. It's really not rocket-science though, to overuse an old adage.

The PDF Tool Kit is my application of choice for appending, merging and splitting PDF files. The most common situation I find myself using his tool is when I have disordered scanned pages, that needs to be arranged.

Here is an example with my passport, my resume and a few pay stubs, all in the PDF format. I need to send a few pages of each of these documents stitched together in a single PDF, to my HR department, for whatever  reason they want this information from me.
[mrigs@localhost ~]$ pdftk A=Passport.pdf B=Resume.pdf C=PayStubs2013.pdf cat A1 A18 B C11-12 A10 A14 A8 output Mriganka_HR.pdf
This is being run on a Mageia 4 Linux system. In this command
  • A=Passport.pdf is my Passport with 18 scanned pages
  • B=Resume.pdf is my resume of 4 pages
  • C=PayStubs2013.pdf is a PDF of my 2013 pay stubs, 1 for every month
  • cat is the command for concatenating PDFs together
  • A1 & A18 extracts the 1st and the 18th page of the passport, respectively
  • B extracts the whole resume and appends to the new PDF
  • C11-12 extracts my November '13 and December '13 pay stubs and appends to the new PDF
  • A10, A12 & A8 are my Visa pages from the passport that gets appended to the end of the new PDF
  • output Mriganka_HR.pdf is the final document that I need to send out to my HR

Quite simple, I'd say, and really very fast too, for completing this merge. For even easier use, there is also a GUI version of the tool available for the Windows platform.

From the pdftk man page on Mageia, here is a list of everyday PDF housekeeping that you can do with PDFTK.
  • Merge PDF Documents or Collate PDF Page Scans
  • Split PDF Pages into a New Document
  • Rotate PDF Documents or Pages
  • Decrypt Input as Necessary (Password Required)
  • Encrypt Output as Desired
  • Fill PDF Forms with X/FDF Data and/or Flatten Forms
  • Generate FDF Data Stencils from PDF Forms
  • Apply a Background Watermark or a Foreground Stamp
  • Report PDF Metrics, Bookmarks and Metadata
  • Add/Update PDF Bookmarks or Metadata
  • Attach Files to PDF Pages or the PDF Document
  • Unpack PDF Attachments
  • Burst a PDF Document into Single Pages
  • Uncompress and Re-Compress Page Streams
  • Repair Corrupted PDF (Where Possible)

Play around and you'd find quite some different usage of this Schweizer Offiziersmesser of PDF management.

Cheers, MT.

Tuesday, April 15, 2014

Social Media and 2014 Elections in India

In the campaigning for the 2014 Assembly Elections in India, Social Media surely is neck and neck with the mainstream media (MSM). There are dedicated IT cells of every major party and especially of the Bharatiya Janata Party, Indian National Congress and Aam Aadmi Party, who have been steadily building up the social media offensive over the past several months. And now with just a few more weeks before the election process comes to a close on 16 May, it's an all out blitzkrieg, with ad agencies, party workers, loyal supporters and volunteers providing equal amount of firepower. And all this for building up favourable opinion among friends, family, followers and the occasional passer-by (page visitor), who form a large chunk of the Indian electorate.

Even MSM has jumped on to the Social Media bandwagon, for airing and publishing election stories and debates. Hashtag wars on Twitter are being used by MSM during debates and interviews, as well as for providing bytes of viewers' opinions during these programs. Facebook is being used for promoting articles, hashtags playing a lesser role here. Facebook is also being used for organizing and promoting interviews by MSM channels. Then there are Hangouts on Google+ which are being used for interviewing party candidates or for interaction with the voters, which are aired live.

Besides the major three SM networks, there are the usual blogs, YouTube videos, ask-me-anything (AMA) sessions and several more ways in which the interwebs is influencing the 2014 mandate in India.

One important message everyone is airing is for the voters to go out and vote. Polling numbers have been encouraging in the first 3 phases, and is expected to be a lot better than earlier elections in the remaining 6 phases.

This election in India is being fought as much online as it is being fought in the minds of the voter, and in the real world!