<action name="printAction" label="_Print..."
icon="xxe-gui:app/icons/printAction.gif
"
accelerator="mod P">
<context editingContextSensitive="false">
<configuration name="XHTML Strict">
<command name="xhtml.convertToPS" parameter='pdf |pdf' />
</configuration>
<configuration name="XHTML Transitional">
<command name="xhtml.convertToPS" parameter='pdf |pdf' />
</configuration>
<configuration name="DocBook v5+">
<command name="db5.convertToPS"
parameter='pdf |pdf "/book toc /article toc" 1' />
</configuration>
<configuration name="DocBook">
<command name="docb.convertToPS"
parameter='pdf |pdf "/book toc /article toc" 1' />
</configuration>
<default>
<class>com.xmlmind.xmleditapp.kit.part.PrintAction</class>
</default>
</context>
</action>URLs starting with " <rewriteURI uriStartString="xxe-gui:"
rewritePrefix="jar:file:/opt/xxe/bin/xxe-app.jar!/gui/" /> |
The standard print action (i.e. the action referenced by the standard menu) is defined as follows in common.xxe_gui:
<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 Strict", invoke command xhtml.convertToPS with parameter "pdf |pdf" to print it.
Same with documents associated to configurations named "XHTML Transitional", "DocBook" and "DocBook v5+".
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.