Added some unit tests for the PdfPublisher
and made some minor code tweaks and refactorings