company logo

Calling document generation from a command line

In order to start document generation from a command line, CreateDocument may be called:

    ...odaba/CreateDocument.exe ini_file [template] [document] [-q] [-h] [-p:type]

The configuration or ini-file contains the data source definition as well as specific options for running the document template. Especially options referred to by the template might be set in the ini-file (see example below). Data source definition options are described in Data Source Options. Program parameters DocumentPath and TemplatePath might be set instead of passing document and template parameters Template options (e.g. Collection and ItemName) are option variables referred in the document template.

Command line document generation is rather helpful in order to detect document template errors. In order to debug a document template, the OSI_DEBUG option has to be set in the [CreateDocument] section of the ini-file (OSI_DEBUG=YES).

Template files are internally converted into OSI template expressions. In order to check the generated OSI code, OSI templates may be stored to a file. The path (complete file path) for storing generated OSI templates has to be passed in the Options section in Documentation.TemplateOutput.

The default template entry point (main OSI function in the document template) is the function with the document name. When a document template has several entry points or when the entry point name differs from the document name, the entry point name has to be defined in the Options section in Documentation.DocumentExchange.TemplateEntryPoint variable.

Often, text fields contain absolute image paths in order to show images on WEB sites or within documents. When moving image folders or when generating documents in different environments, image paths may have to be replaced by new locations. ODABA document generation provides a simple mechanism for replacing image paths. When an image could not be located at a given file position, the document generator tries to locate the image file at all locations passed in the ALTERNATIVE_IMAGE_PATH option in the CreateDocument section. Directory names in the option have to be separated by : (Linux) or ; (MS Windows).

; windows ini-file

[SYSTEM]

DICTIONARY=L:\adk\ode.sys

[CreateDocument]

; data source specification

DICTIONARY=L:\adk\ode.sys

RESOURCES=L:\adk\ode.dev

DATABASE=L:\opa\opa.dev

ONLINE_VERSION=YES

ACCESS_MODE=Write

NET=YES

TRACE=e:\temp\reinhard

DSC_Language=English

; program environment

ODABA_ROOT=L:\odet\

CTXI_DLL=AdkCtxi

; debug options

OSI_DEBUG=YES

; program parameters

DocumentPath=L:\opa\doc\odabagui.odt

TemplatePath=l:\opa\tpl\ReferenceDocu.odt

; template options

Collection=ODC_Project

ItemName=odabagui

; alternative image pathes

ALTERNATIVE_IMAGE_PATH=E:\my images;L:\your files

[Options]

; write generated OSI templates to file

Documentation.TemplateOutput=temp/ootemplate.osi

; define different entry point

Documentation.DocumentExchange.TemplateEntryPoint=DocMain