Fix authentication

Didn't previously check for user name (it's awkward because of the http
auth module used) and the check for whether to setup auth was backwards.
Also log failed requests (they were previously ignored).
close settings file after reading it
Better handling docs with embedded data

Delete the base64 data after encoding, so it doesn't serialize back to
the notification recipient.  Also record the file size of the decoded
embedded doc
Linearize output PDF file