Document generated from script

circle-info

The availability of functionalities depends on the license and may not be available in all deployments.

The document can be generated using a script that the form designer provides in the document generator configuration. In such a case, you should use generator type 'documentFromScript'.

Example configuration (XML fragment):

Example form source
<data:DocumentGeneratorItems>
  <data:DocumentGeneratorItem 
      generatorName="documentFromScript" 
      fileName="Wniosek Dobry Start.pdf" 
      scriptName="adap_document-*"/>
</data:DocumentGeneratorItems>

The new generator type is distinguished by two key elements:

  • generatorName must take the value documentFromScript

  • scriptName points to the script service in the format: SCRIPT_SERVICE_NAME-VERSION_NUMBER (e.g. adap_document-*).

The script service that is tied to the document generator should return two fields:

  • output - file content encoded in base64 format (required),

  • fileMimeType - the file's content-type; an optional parameter – if not returned, the generator will assume the default value 'application/pdf'.

circle-exclamation
circle-info

Demo forms: demoScriptDocumentGenerator (script: demo_generowanieDokumentu) and demoDocumentGeneratorAndDocumentList (script: demoDocumentGeneratorScript)

Last updated

Was this helpful?