Wednesday, December 4, 2013

PDF fun

So I needed to create scan a 2 page document into .pdf format.  I went up to the computer that the scanner is connected to and scanned the document unto a multipage .tiff file.  Then I went downstairs to my laptop and copied the file.  Immediately afterwards, I realized that I'd skipped a step.  Usually, I convert the .tiff file to .pdf on the upstairs computer, using IrvanView.  My laptop is running Fedora, so IrfanView is not an option.  The solution?  A command-line program called tiff2pdf that I learned about here.
Once I looked at the finished .pdf, I realized I'd scanned the documents landscape--my only option--but the document is actually a portrait document.  How could I go about rotating it?  Irfanview?  Probably, but I didn't want to go back upstairs.  I've used pdftk for merging .pdfs, but wasn't sure if it could rotate files.  As it turns out, it can!
Once that was finished, I remembered something else: I was supposed to number the documents.  I didn't want to write on the documents themselves, and I didn't want to copy the documents and then rescan them either.  I was thinking that IrvanView would have been my best bet--I could have added the numbers in the editor before exporting to .pdf.  If only there was a way to add a watermark to a .pdf.  As it turns out, pdftk can do that too!  But then, the watermark itself needed to be a transparent .pdf, and I had no idea how to do that.  I found the answer here:

convert $INPUT.PNG -transparent white -background none $OUTPUT.PDF
pdftk $FORM.PDF stamp $OUTPUT.PDF output $COMPLETED_FORM.PDF

No comments:

Post a Comment