Wednesday, July 21, 2010

The easy (easiest?) way to sign pdf documents

PDF documents are a pain in the butt if you're trying to eliminate paper and work electronically.  They're hard to edit unless you want to spend a bundle on the official Adobe program, and I'm way to cheap for that.

Okular works well for adding annotations, but it doesn't help at all for adding a signature to PDF docs.  For that you have to be able to either draw a random line (your signature) or insert an image (of your signature).

Why do it?
Why would I want to electronically insert my signature into a PDF doc?

Well, to sign it of course.  Let's say I have to transfer money from my bank account.  They won't let me do that online; for security they want a hard copy of a signed authorization form.

The bank wants to fax it to me, have me sign it, and fax it back.

Here's the catch: my fax machine is buried in a landfill somewhere, a layer above my old dot-matrix printer and a couple layers below my external ZIP Drive.

Sure, I could receive the fax into my computer (or get it my email), print it out, sign it, scan it back into my computer, then email or fax it back.  But there are some problems with that.

First, it wastes paper.  Second, it's not elegant.  Third, it violates the basic principle of Hopeful Hacking, which is that if you expend enough time and effort experimenting, you can always find a better (or at least different) way of doing things.

Back from the digression
Here's another option.  To do it, you have to have a graphics editing program called GIMP.  It's in the Ubuntu repositories, so you can added it with Synaptic or by typing
sudo apt-get install GIMP
at the command line.   (It's available for Windows as well as Linux).

GIMP used to come with Ubuntu, but as the developers added more abilities, the folks at Ubuntu decided it had become more than the basic functionality they like to include with the base install.  I'm sure it also added to the difficulty of fitting the Ubuntu installation on a single CD.

All that functionality is great, but it's specifically not the point of this post.  The point here is to use GIMP to do just one thing: add your signature to PDFs.

Opening GIMP gives you three windows: the main editing window (in the middle), the Toolbox (on the left) and the Layers, Channels, etc window (on the right).

If, for some reason, they're not open, you can use CTRL+T to open the Toolbox and CTRL+L to open the layers window.

You can clear clutter by closing any other windows that happen to open.

Your Signature
First, you have to create an electronic image of your signature.  We're going to do it entirely on the computer.

Another option would be to sign a blank piece of paper, then scan it into your computer.
In the main window, click
File > New
You'll get the Create a New Image dialog box.

Click on the Template dropdown menu and select US-Letter (300ppi), then click the + sign by Advanced Options.

Click the Fill With dropdown menu and choose Transparency.  This is critical.  If you don't use a transparent background, your signature will mess up the document you're trying to sign.

Click OK and you should get a blank image with a transparent background.  GIMP uses a light and dark gray checkerboard pattern to indicate transparency.

At the bottom left of the main editing window you can adjust the size of the image.  I chose 25%, but you can pick whatever you want as long as it's big enough to sign your name and not so big that you have to scroll to see it all.

To get ready for signing your name, go over to the Toolbox window.

Click on the icon for Pencil Tool.

Below the tool icons there are some options for the Pencil Tool.  Normal mode is fine.  Opacity should be 100%.   Brush sets the size of the line you'll be drawing.  I think Circle (11) works pretty well.  You can experiment.  Scale starts at 1.  You can move the slider to make the line thicker or thinner.

Just remember that you should judge by the way it looks in the final document, not the way it looks now.
Now you draw your signature.  This can be the hardest part of the whole process.

I used the mouse.  You just hold down the left mouse button and write.  When you release the button, the writing stops.  Press it again to start writing again.

You can hit CTRL+Z to erase the last thing you wrote and try again.

After using CTRL+Z a couple of dozen times, you might start wondering if there's a better way.
Well, sure there is.

You could write on a piece of paper and scan it, as I mentioned earlier.

Another option is to get a graphics tablet.  I have an old WACOM Graphire that connects through a USB port.

It works great but, frankly, I wouldn't buy one just for this.  With a little practice you can get a pretty good signature using your mouse, or even a touchpad.

OK, maybe not the touchpad so much.  That's what I used to copy John Hancock's signature here.
If anyone ever accuses me of forging a copy of the Declaration of Independence, this should clear me.

Once your satisfied with your signature, or at least tired of working on it, you just have to save it properly.

First, we should get it down to a reasonable size.  That US-Letter size image space made plenty of room for writing, but it's a lot bigger than necessary.

Go back over to the Toolbox and select the Rectangle Select Tool.

It's a little rectangle icon at the upper left.

Now you draw a rectangle around your signature.  Pick the part that sticks out the farthest and put the cursor just beyond the line.  Left click the mouse and move the cursor toward what will be the opposite corner of your selected rectangle.  Then release the mouse button.

The result should look like this.

With the signature selected, go to the menu bar and select
Image > Crop to Selection

At this point, you could make a decision.  But I suggest you don't.  If you've followed these instructions as meticulously as I know you have, your signature is going to be pretty doggone big compared to the document you'll be signing.  Unless you really are forging the Declaration of Independence.

You could go back up to the Image menu, choose Scale Image and shrink it down to a more reasonable size.  It would actually save you a bit of trouble later, but it could also cause you problems later.

For the moment, I suggest you leave the size alone, (which is what you probably would have done if I hadn't brought this issue up).  On second thought, forget I mentioned this.

You'll want to save the image as a PNG file.  They compress nicely, they're versatile but, most important for this exercise, they save transparency.  JPEGs don't do that.

Oh, GIMP actually has it's own file format that makes it easy to make adjustments later.  It's .xcf.  That's dot-xcf and then a period that's not related to the file extension.

If you want to save the file that way first, it will make it easier to come back and adjust your signature later if you want.

In any case, for what we're doing, you'll need a png file.  Select
File > Save
In the Save Image dialog box, choose a name like signature.png (for now, you can change it to xpdjf.dtr later for security).

This is the end of Part 1.  You only have to do this part once, providing you don't give the file a random name and store it in an obscure place and lose it forever.

Is it safe?
OK, you may also be wondering if it's secure to store a digital image of your signature on your computer.

I don't know.  I guess it's as secure as a lot of other things.  Now that you have a nice digital image of your signature, I wouldn't suggest posting it on Flickr, no matter how elegant it is.  That would be asking for trouble.  

Emailing it doesn't seem less secure than faxing, or snail mailing.  People send faxes to wrong numbers all the time.  Someone could intercept a bill payment in the mail.  How hard would it be for someone to cut your signature out of something and scan it themselves?

Someone could hack into your computer and steal the image.  But once they're in your computer there's probably a lot of things they could do to make you miserable.  If you're worried about it, give the file a name like expidff.conf and save it to /proc/1415.   I've done that with files and never found them again myself.

Adding your signature to the PDF doc
Now we're getting somewhere.

In the main GIMP window choose
File > Open
and select the PDF file you want to sign.  I'm using one called lease.pdf.

Instead of popping right open, you get an Import from PDF dialog box because GIMP can't open PDFs directly.

Select the page or pages you want, then click Import.

When it opens, scroll down to the place you need to sign.  Remember that you can adjust the view size at the bottom left of the window.

Now go back up to the top and choose
File > Open as Layers

Choose your signature image file and open it.

You may not see it very well in the edit window; it's going to be huge and may be at the edge of the window.

You will see it in the Layers window.

It will be right above the imported PDF image which will be named something like "1".

It helps here to know just a bit about how GIMP works.  It builds images from independent layers.  You can add layers, delete layers, edit layers, move layers up and down and a lot more.

In this case, you're only going to have two layers: the imported PDF file and the signature.  Make sure the signature layer stays on top of the PDF doc layer.  Literally.  As long as it's above the PDF doc layer in the Layers window, it will be above the PDF doc in the edit window.  If it somehow moves below the PDF doc layer, you won't see it in the editing window.

The first thing we're going to do is make you signature a more reasonable size.  With it's layer highlighted in the Layers window, move back over to the editing window.  Select
Layer > Scale Layer

In the dialog box that opens, enter 250 into the Width box.  It's just a guess, you can adjust it later.

Click Scale.

(By default the Width and Height boxes are linked -- as indicate by a little chain link image to the right of the boxes.  When you entered 250 and hit Tab, it should have automatically changed the Height number to preserve the aspect ratio of the signature image.  If it didn't, your signature will be really tall and narrow.  If that happens, hit CTRL+Z to undo the scaling.  Once the layer is back to its original size, reopen the Scale Image dialog box and click on the little chain image.  That should change it from an unlinked chain to a linked chain.   Then just reenter the width).

Now go over to the Toolbox and select the Move Tool.  It looks like a plus sign with arrows at the end of the lines.

Lower down in the Toolbox, select Move the active layer.

Now put your cursor on the signature layer, hold down the left mouse button and draf the signature to the right place on the PDF doc.

There you go.  You can adjust the position or the scale to make it look right.
To add the date (there's always a date), go back to the Toolbox and click on the Text Tool icon.

Put your cursor where you want to start the date and left click the mouse.  The GIMP Test Editor box will open.  Enter the date and click Close.

If it's not in the right spot, you can move it.  It's another layer.  Click on it in the Layers window, choose the Move Tool again and put it in the right spot.

Now all you have to do is create the final, signed PDF document.
Go to
File > Print

Instead of selecting a printer, select Print to File.

Enter a file name, choose a folder to store it in and for Output format select PDF.  Click on Print and your done.

When you open the new PDF document it should be the original plus your signature and the date.

Wednesday, July 07, 2010

Inbox growing? Delegate to an always-available, eager-to-help assistant

In just a few minutes you can stop being a slave to your inbox and make you inbox a slave to you.  All you have to do is delegate

In this case, you're delegating to Gmail (or whatever email service you use).

If that sounds odd, consider this:  Gmail is eager to help, it's always available and, with it's easy-to-use and precise filtering rules, amazing nimble and judicious.

Here's an example of what I mean:  Let's say you have an investment account and it sends you regular messages.   Every day you get a closing summary, once a month or once a quarter you get a full report on your portfolio, you get announcements about annual meetings of companies whose stock you own, and somewhat regularly you get what amount to sales pitches. And they all come from the same email address.

Gmail can handle that just like you do.

Assume they all come from Investment Alert.  The subject lines each identify the contents of the message:

  • your eStatement
  • Closing Summary
  • Annual Meeting
  • deposit to investment account
  • Annual Report

With rules, you can handle each of those messages in a different way.  Here's how.

Open an eStatement. Click:

More Actions > Filter messages like these

The From: box should already have in it the sender -- your investment company.  Two boxes below that you'll see Subject:

type eStatement

then click

Test Search

This is important.  It helps you make sure your criteria are catching all of the messages you're trying to filter and, possibly more important, none of the message you don't want to filter.  Just review the list of messages that show up to make sure they're all what you want.

Then click:

Next Step

Here you decide what to do with these messages.  I don't read the eStatements as they come in, but I like to review them if I get a chance.  As a result, I want them out of my inbox, labelled "investments" and marked as read (so they don't add to my already depressing unread count.  To do that, use these options:
check "Skip the Inbox (Archive it) 
check "Mark as read" 
check "Apply the label: and select "investments" from the drop-down menu (or select "New label" and create it) 
If you have a few of these messages in your inbox, they should be listed below the filter.  To handle all of them:

check "Also apply filter to x conversations below"

Finally, click
Create Filter
Have two investment accounts (or whatever kind of message you're filtering)?  Apply the same filter to both.  In the From: box:

  • parenthesis around the from address
  • add a space
  • type OR (all caps)
  • add a space
  • type the second from address in perenthesis

The From: box should look like this: ( OR (

Now the filter will handle email from both senders.