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:

  1. Switch to the Files window, create a top-level folder called 'release' in your module source structure, and put your PDF document there.

  2. 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.

  3. 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>

  4. 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.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today