Changed the way the PDF library is loaded.

The PDF library was loaded through a type initializer which was not called sometimes. The implementation has been changed, hopefully working around this.

Bug: #4