Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

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.

Sunday, March 30, 2014

Taking backups on Linux

With RSYNC around, who needs any other backup software on Linux!

I have found rsync to be quite the handy tool for backing up my data on external storage devices.

Here is one of the commands that I use regularly on my Mageia system, for backing up my movies from one external hard disk drive to another -
[mrigs@localhost ~]$ rsync -azv --delete /run/media/mrigs/TheGrid/yemt/ /run/media/mrigs/TOSHIBA\ EXT/yemt/
where

-a is for
  • Recursive mode
  • Preserving symbolic links
  • Preserving permissions
  • Preserving timestamp
  • Preserving owner and group

-z is to enable compression

-v is for verbose

--delete is used for deleting files in the target directory that are not present in the source directory

/run/media/mrigs/TheGrid/yemt/ is my source directory in external hard disk 1

/run/media/mrigs/TOSHIBA\ EXT/yemt/ is my target directory in external hard disk 2

Like any other Linux command, there are several ways to use this command for your varied needs. "How to Backup Linux? 15 rsync Command Examples" is an excellent resource for finding some of the most frequently used rsync scenarios.

Then there is GRSYNC, for those who prefer the GUI way to do things.

Monday, June 6, 2011

Almost time for an upgrade, and a test drive

Two recent FLOSS announcements has me excited - maiden release of Mageia and the Beta3 version of Mandriva 2011. Means I have something new (nothing geeky, I assure you) to write about. It's about time I did some justice to the fact that I earn my livelihood from a related industry. Read on.

Would have loved to see Mandriva announcing a final 2011 version by now. But, considering the fact that it has recently been into too much of a turmoil, this nearer to stable release is more than welcome. For the uninitiated, Mandriva is a Linux distribution specializing in the desktop OS segment. It has also made some foray into the  corporate market providing server class solutions to a few medium and large organizations.
Mandriva Logo
Sales pitch aside, Mandriva has always been my distro of choice whenever I wanted Linux on my personal computer, from the days I started using one of it's earlier avatar, Mandrake 7.0. During those college days, besides the learning motive, Mandriva gave me a better looking option against the rather dull Windoze XP (and the duller 98). And then, unlike other distros of those days, it let me play MP3s, watch videos and could 'see' all the FAT32 partitions without much of the geeky mount magic. It got me hooked and I have remained faithful ever since. The reasons have remained pretty much the same over the years with a few minor geeky additions. Look and feel is one big factor influencing my choice of distros and I have preferred it's bluish look to the rather dull brownish default look of Ubuntu. A default brown setup somehow does not strike any chords with me, even to attempt any customization. How I wish Mandriva had a large and strong user base as Ubuntu. It's an easy to use, effective and great looking distro and that is why I spare no opportunity to let people know about it (noticed the Mandriva logo on this blog?).

Mageia, who? For those of you who never heard of Mandriva, I would understand it'd not be wrong to assume that this is the first time you are hearing of Mageia. Mageia, is also a Linux distribution, recently forked out from Mandriva.  
Logo design by Olivier Faurax
The often tumultuous financial situation of Mandriva, led some of its employees and loyal community members to fork out Mageia as an independent community-centered distro. Besides having it's root in Mandriva, this community driven nature is what makes Mageia appealing to me. I wish it luck and hope it fares better than Mandriva.

I am all set to download both these distros and install them on the very first opportunity I get. I'd give myself a couple of weeks to clear out a few priorities and make some space in my bloated laptop, before taking the plunge.

Be it Mageia, Mandriva or Ubuntu, or for that matter even Android, giving us, the users the ability to influence decisions and directions is what enthralls me the most about FLOSS (free/libre/open-source software), and Linux in particular. FLOSS, in fact is about letting people make their choices.