Some cleanup and started fixing PDF display.

Trying to stick to proper commits again...
Load image using PIL instead of GdkPixbuf.Pixbuf.new_from_file
Added margin controls, changed drawing order, moved device properties to own class, added image threshold conversion
Added threshold control. Does not work yet, code needs to be restructured first.