Documentation

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
templateIdTemplate ID.
valueExternal 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”.
valuesSet 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.
stampsEnabled1 (add), 0 (remove) stamps and signatures.
fieldsDescription for document fields. This parameter is an array, where the key - field name and value - description.

Codes for standard field types:

  • TYPE — field type
  • FORMAT — format;
  • PROVIDER — provider;
  • TITLE — title;
  • IMAGE — image;
  • STAMP — stamp / signature;
  • DATE — date / time;
  • NAME — name;
  • PHONE — phone number.


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