Reputation: 85
I have a .pdf file added as a resource file to my .ntf database. I would like to , through an action, to open that file with whatever .pdf reader is installed on user machine. I have read this post Lotus Notes - open a file from Action Button but my file doesn't really reside on normal file system, but is rather part of database itself.
Thank you for your kind help
Kindest regards, Carlos
Upvotes: 1
Views: 3159
Reputation: 720
If there are multiple copies of the application design managed through a template, and the same PDF is applicable to all of them, then it can be nice to make the file part of the template design rather than putting it into a document. Rather than a file resource, it's easier to get the file to open if you attach it to a design element -- a form or a page. With a form, you should still be able to use the form launch option as described in the previous post (you might need to use LotusScript -- create a back-end NotesDocument object with Form=whatever, then use wksp.editdocument to open it in read mode) -- or you can use code to read the design note (locate it using NoteCollection class), grab the rich-text $Body item, get the EmbeddedObject, save it to a file, and launch it using a shell function.
It's possible to extract the contents of a file resource using DXL, and if you get the LotusScript Gold Collection from openntf.org, there's example code for this. It just might be slower and more complex than you need for this task.
In other news, if the server's Domino HTTP service is running, you could use a URL to serve up the file. In that case, the URL of a file resource is easier to come up with than the URL of a file attachment on a form.
Upvotes: 2
Reputation: 12080
Having a pdf as a resource is not a really good idea. Programmatic Access to it is quite restricted, and whenever the PDF changes, you need a Domino Designer to replace it.
Better create a Form, that has one Richtextitem. Create one document with that form and attach the PDF. Then set the form options to launch the first attachment... After that you just need a way, to open that document (get unid via DbLookup, or getdocumentbykey, or any other convenient way... And your done.
If you make a button to directly edit the document, then the form option will be overwritten, and you can exchange the PDF whenever you need to...
Upvotes: 2