<action name="printAction" label="_Print..." icon="xxe-gui:app/icons/printAction.gif" accelerator="mod P"> <context editingContextSensitive="false"> <configuration name="XHTML"> <command name="xhtml.convertToPS" parameter='pdf |pdf' /> </configuration> <configuration name="DocBook"> <command name="docb.convertToPS" parameter='pdf |pdf "/book toc /article toc" 1' /> </configuration> <configuration name="Simplified DocBook"> <command name="docb.convertToPS" parameter='pdf |pdf "/book toc /article toc" 1' /> </configuration> <configuration name="Slides"> <command name="slides.convertToPS" parameter='pdf |pdf' /> </configuration> <default> <class>com.xmlmind.xmleditapp.kit.part.PrintAction</class> </default> </context> </action>
The standard print action (i.e. the action referenced by the standard common.xxe_gui:
menu) is defined as follows in<action name="printAction" label="_Print..." icon="icons/printAction.gif" accelerator="mod P"> <class>com.xmlmind.xmleditapp.kit.part.PrintAction</class> </action>
Therefore if we define a contextual action having the same name, "printAction
", this suffices to install our custom action. Note how the icon
attribute is specified in our redefinition of the print action.
The above contextual action can be described as follows:
If the document to be printed is associated with a configuration named "XHTML
", invoke command xhtml.convertToPS
with parameter "pdf |pdf
" to print it.
Same with documents associated to configurations named "DocBook
", "Simplified DocBook
" or "Slides
".
If the document to be printed has no associated configuration or is associated with a configuration other than the above ones, print it using action implemented by Java™ class com.xmlmind.xmleditapp.kit.part.PrintAction
(same as stock print action).
Elements configuration
and default
can contain actions implemented in Java™ or can contain commands (see Chapter 6, Commands written in the Java™ programming language
in XMLmind XML Editor - Commands). Referencing an action is easy to understand, but what is this command xhtml.convertToPS
used to print XHTML documents?
The configuration file for XHTML documents is
. The XXE_install_dir
/addon/config/xhtml/xhtml.xxename
attribute of the root element of this configuration file is XHTML
(see Section 3, “configuration” in XMLmind XML Editor - Configuration and Deployment).
This configuration file includes another configuration file
. A process command called XXE_install_dir
/addon/config/xhtml/xslMenu.inclxhtml.convertToPS
is defined in xslMenu.incl
. This process command, with parameter "pdf |pdf
", converts the document being edited to PDF[3].
[3] In the future, a process command will be able to directly send the result of the conversion to a printer — typically a PostScript™ printer — chosen by the user.