I’m doing a lot of mobile stuff these days, but XPages is another big part of my work and this will not change in the foreseeable future. One project I’m working on is a tool to put iNotes mails into an archive system.
While doing that, the user should be able to view attachments a mail might have – including PDFs. View means viewing in the browser, not downloading the file to the computer. But exactly this happens when you open a typical Domino URL like /db.nsf/0/<UNID>/$FILE/filename.pdf.
You can display images inline using the embed tag. That’s very simple. But that does not work for PDFs. So what now?
- Download the stable version from http://mozilla.github.io/pdf.js/getting_started/#download
- Extract the archive to some folder. In Designer, open the Navigator view, navigate to the WebContent folder, rightlick and select ‘import’, then import the folders ‘web’ and ‘build’ into the NSF.
- Now you can call the PDF viewer with an URL like this: http://host/db.nsf/web/viewer.html?Open&file=/db.nsf/0/<UNID>/$FILE/file.pdf