This tool is an advanced print function that can be configured as either a quick print (click once) via a button in ribbon or a custom print via a user interface. Thus, this feature has two commands, and this article elaborates both ways of configuring the feature.
Quick print from ribbon
When configuring this feature as a quick print option, we specify the various settings directly in the module - in contrast to the custom print where we define some presets, but the user will be able to adjust the settings in the interface.
CMD
<Cmd case="BaseExtensions:print-advanced"/>
Parameters
PrinterName
This parameter is required, but ignored if PrintToFile
is true
. Define the name of the printer. We support using Default
as the printer name to use the currently selected printer.
If the printer does not exist on the system, a message is shown what happened and which printer we tried to access.
PrintWhat
This parameter is required. Define what should be printed with one of the following values:
Document
DocumentProperties
DocumentShowingMarkup
Comments
Styles
AutoTextEntries
KeyAssignments
Duplex
This parameter is optional. Set to true
if the feature should print on both sides of the document.
If the user tries to print in duplex to a printer that does not support duplex printing, it will throw an error.
PrintEvenOddAll
This parameter is optional and controls what should be printed in the selected range. This can be set to one the following three values:
All
Prints all pages in the selected range.
Even
Prints even pages in the selected range.
Odd
Prints odd pages in the selected range.
PrintToFile
This parameter is optional. Set to true
if the feature should print to a file and not a physical printer.
PrintToFileNameAndPath
This parameter is optional, but required if PrintToFile
is true
. Define the file name and path for the output document, e.g.: "C:/output/output.pdf".
PrintSize
This parameter is optional and defaults to whatever the user has set in their document. This parameter controls the size of the printed documented, which can be one of the following values:
A3
A4
A5
Letter
If the particular printer does not support the size, it will throw an error.
Printmode
This parameter is optional. Define to Manual
if the feature should create a manual duplex print. User is prompted by the printer to turn pages.
PrintRange
This parameter is optional and defaults to all pages (document). Define the range of pages to be printed - this can be a value like "1,2,4,5-10"
to print pages 1, 2 and 4, and pages 5 to 10, or it can be one of the following case sensitive values:
Document
Selection
CurrentPage
NumberOfCopies
This parameter is optional and defaults to 1. Define the desired number of copies.
Collate
This parameter is optional and defaults to false
. If the parameter is defined to true
, it sets the desired collation.
PagesPerSheet
This parameter is optional. Define the desired amount of pages per sheet. The parameter accepts the following values:
1
2
4
6
8
16
FirstPageTray
This parameter is optional, but must be a valid tray name. Define the name of the tray from which to take paper for the first page.
RemainingPagesTray
This parameter is optional, but must be a valid tray name. Define the name of the tray from which to take paper for the remaining pages.
Custom print from UI
When configuring the custom print feature, we have a simple button in ribbon that opens a user interface. This is based on some presets that are set in a json file, which we refer to in the module. The presets are the same properties as used in the command above.
CMD
<Cmd case="BaseExtensions:print-advanced-ui"/>
Parameter
PresetPath
Define the name of the json file which must be located here: ...\Content\BaseExtensions
.
Print presets in json file
The json file contains the presets for the user interface. There can be as many presets as needed, where each preset has a name, print settings and also watermark settings if this is needed.
The name of the preset is what is shown in the interface (see the image above). The print settings contains the same properties as used when configuring the feature as a quick print (in a module).
This client has a wide range of presets that can be selected in the drop-down in the interface. The example below shows two presets, Letter and File, where File should set a watermark when printing:
{ "Presets": [ { "Name": "Letter", "PrintSettings":{ "Duplex":"false", "PrinterName":"Default", "PrintSize":"A4", "NumberOfCopies":"1", "FirstPageTray":"Tray 1", "RemainingPagesTray":"Tray 2", "Collate":"true", "PagesPerSheet":"1", "PrintWhat":"Document", "PageRange":"All" } }, { "Name": "File", "PrintSettings":{ "Duplex":"true", "PrinterName":"Default", "PrintSize":"A4", "NumberOfCopies":"1", "FirstPageTray":"Tray 3", "RemainingPagesTray":"Tray 3", "Collate":"true", "PagesPerSheet":"1", "PrintWhat":"Document", "PageRange":"All" }, "Runs": [ { "Watermark": { "SourceDocName":"WatermarkSource.docx", "AutoConfigure":"All", "Name":"SDWATERMARK", "Type":"Picture", "Content":"file.png" } } ] } ] }
Comments
0 comments
Article is closed for comments.