documentgenerator.document.add
documentgenerator.document.add(templateId, value, values = [], stampsEnabled = 0, fields = [])
The method creates new document based on a template. On success, a structure is returned similar to the method documentgenerator.document.get() on a new document.
Parameters
Parameter | Description |
---|---|
templateId | Template ID. |
value | External ID. The value parameter is needed only for the application UI, as an external source ID. It's a string parameter: you can pass full-fledged external code in it. For example, "PARTNER_APP_10_BILL_133” . |
values | Set of values for document fields. In standard case, it is a one-dimensional array, where the key - field name and value - string to be inserted into the document. |
stampsEnabled | 1 (add), 0 (remove) stamps and signatures. |
fields | Description for document fields. This parameter is an array, where the key - field name and value - description.
Codes for standard field types:
|
Examples
Please see example of generated document.
Why the document.add result does not contain link to pdf?
Converting into pdf - is an asynchronous operation when PDF file is not available immediately after generating a document.
In cases when pdf format is required, the only option is to query documentgenerator.document.get again and a link to pdf becomes available after 20-30 seconds period. When a pdf link doesn't appear - repeat the attempt.
© «Bitrix24», 2001-2024