Thursday November 06, 2008
How to Create a Menu Item to Invoke a PDF Document
In situations where you want a menu item to produce a PDF document (e.g., as in the case with the shortcuts.pdf card in NetBeans IDE), do the following:
- Switch to the Files window, create a top-level folder called 'release' in your module source structure, and put your PDF document there.
- Create an XML file with this content:
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD PDF Document Menu Link 1.0//EN" "http://www.netbeans.org/dtds/pdf_link-1_0.dtd"> <pdfLink> <idefile base="shortcuts"/> </pdfLink>The above implies that the document will be named 'shortcuts.pdf' and that it will be found within the main folder of the module. If you put 'docs/shortcuts', for example, then the 'docs' folder of the module will be used instead. But then you would have to put the PDF in 'release/docs' instead.
- In your layer.xml file, register the above XML file, which in this case is called 'shortcuts.xml', as follows:
<file name="shortcuts.xml" url="nbresloc:/com/me/bla/shortcuts.xml"> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.me.bla.Bundle"/> <attr name="position" intvalue="480"/> </file> - In the Bundle referenced above, put the following:
Menu/Help/shortcuts.xml=Keyboard Shortcuts
Thanks to this mail thread, I put the above steps together. Similarly, you can open a URL instead of a PDF from a menu item, following these instructions.
Nov 06 2008, 01:37:13 PM PST Permalink


