Geertjan's Blog

  • November 6, 2008

How to Create a Menu Item to Invoke a PDF Document

Geertjan Wielenga
Product Manager
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" 
    <idefile base="shortcuts"/>

    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"/>

  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.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.