Removed code to construct PDF URL from document URL (failed without trailing slash); replaced to query View as PDF button for its href attribute.