Commands


Commands are instructions which are executed sequentially after reaching predefined intermediate results or events. Commands can be partially available only at the server or client call. A basic distinction is made between two command levels:

DocumentCommands Document commands are executed per document, directly after creation of the respective document.

BatchCommands Batch commands are executed at the highest level, after all document commands of the individual entries have been executed.


Availability of all commands

Command

Description

Document

Batch

Client

Server

Command

Description

Document

Batch

Client

Server

DefaultProcess

Starts the default process registered in Windows for the file type

✓

✓

✓

 

ConvertToDocument

Converts Office templates (.dotx, etc.) to Office documents (.docx, etc.)

✓

✓

✓

✓

ConvertToPdf

Converts templates or documents (.dotx/.docx) to PDF (.pdf)

✓

✓

✓

✓*

Print

Sends the document to the default printer

✓

✓

✓

 

SaveAs

Saves the document to the specified destination in the specified format

✓

✓

✓

✓*

UpdateFieldsOnOpen

Updates fields and the table of contents in the document

✓

✓

✓

✓

Merge

Connects multiple Office documents into one

 

✓

✓

✓

CreateConnectorResult

Creates a primedocs connector result file

✓

 

✓

 

BindCustomXML

Binds all custom controls with the respective data

✓

✓

✓

✓

InvokeProcess

Calls a specific program registered in the primedocs dashboard

✓

✓

✓

 

*with certain restrictions


DefaultProcess

This command starts the DefaultProcess registered in Windows for the generated file type. This call works only via the client. Possible parameter:

  • Start: True/False, if False the process will not be started.

<Command Name="DefaultProcess"> <Parameters> <Add key="Start">true</Add> </Parameters> </Command>

ConvertToDocument

This command applies only to Word documents. primedocs manages and generates Word templates (.dotx). To get a Word document (.docx) after generating the document, this command is needed. If this specification is missing and the result is saved as a .docx file, Word displays an error message..

<Command Name="ConvertToDocument" />

ConvertToPdf

Verfügbarkeit: primedocs Server & primedocs Client

This command is only valid for Word Office documents. primedocs converts the document directly into a PDF.

<Command Name="ConvertToPdf" />

Not all Open XML or Microsoft Word features are supported for PDF conversion via this command. As an alternative there is the possibility to use the installed Microsoft Office for the PDF conversion via the SaveAs command in the client.

NOTE
If custom fonts are used in the document, these fonts must also be installed on the server.


Print

The document is sent to the default printer:


SaveAs

CAUTION
On the server, this command cannot be used to convert a Word document to a PDF! Use ConvertToPdf for this purpose.

Saves the document at the specified destination. The new file location is taken into account for all following commands (e.g. in DefaultProcess).

Possible parameters:

  • Filename: Absolute path with file extension

  • Overwrite: True/False; specifies whether an existing file should be overwritten.

  • CreateFolder: True/False; specifies whether to create folders specified in the filename.

  • AllowUpdateDocumentPart: True/False; if True, the primedocs Document Part will be marked as "SavedDocument" instead of "NewDocument".

  • CopyOnly: True/False; if set, the document will be saved as a copy in its current state. In the client use case the file is nevertheless e.g. still treated as "Template (.dotx)" and created in the Temp folder and Microsoft Word is opened from this file.

NOTE
In previous versions, the Type parameter could be specified additionally. This is no longer needed, since a type conversion is implicitly derived via the file extension of the target file.


UpdateFieldsOnOpen

This command applies only to Word documents and stores the information in the document that Office should update the fields, (e.g. tables of contents or links) when opening. Normally, when the document is opened, the user is directly asked if the fields should be updated:

Alternatively, primedocs can be instructed to update the fields independently via the primedocs ribbon without prompting when opening:


Merge

The merge command applies only to Word documents and can be used to merge multiple documents. The merged document can then be reused as a single document. The command is only available as a BatchCommand.

The result of the merge command is always a Word document (.docx).


CreateConnectorResult

This command creates a file in XML format with a summary after the entire document creation process is completed.

The contents of the file will look something like this if successful:

In case of an error, the file also contains an error message including a stack trace from primedocs (if possible):


BindCustomXML

This command is only valid for Word documents. primedocs stores all data as so-called "CustomXML data" in the document and Office loads this data when opening the document and writes the values into the respective ContentControls.


InvokeProcess

In the dashboard the allowed applications have to be whitelisted first. The configuration for this can be found in Settings → Connect Settings → InvokeProcess – Configuration and looks roughly as follows:

The call in the connect file must match the name of an application previously shared in the dashboard. The call can optionally contain arguments and looks like this:


 

PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland