export DEBUG=true
paths:
/:
post:
summary: Render a document.
requestBody:
json_data:
description: json data
content: application/json:
template:
description: template .docx file
content: application/msword
include_attachments:
description: include attachment files
content: True
document_names:
description: output document names without extensions
content: application/json
fields: {
"contractProforma": "contractProformaFileName",
"contractData" : "contractDataFileName",
"contractTemplate": "contractTemplateFileName"
}
responses:
'200':
file:
description: Generated file
content: application/pdf
post:
summary: Get template JSON schema.
requestBody:
json_data:
description: json data
content: application/json:
template:
description: template .docx file
content: application/msword
get_template_json_schema:
content: True
hide_empty_fields:
description: hide empty fields of the schema
content: True or False
responses:
'200':
data:
description: generated JSON schema of the document
content: application/json
# Additional requests:
post:
summary: Get template JSON tag schema.
requestBody:
json_data:
description: json data
content: application/json:
template:
description: template .docx file
content: application/msword
get_template_tag_schema:
content: True
responses:
'200':
data:
description: generated JSON tag schema of the document
content: application/json
post:
summary: display html form from the document
requestBody:
json_data:
description: json data
content: application/json:
template:
description: template .docx file
content: application/msword
display_template_form:
content: True
responses:
'200':
data:
description: generated HTML document
content: text/html
Renderer have some limitations such as can't add picture to header or footer using InlineImage, for resolve this problem, renderer has reserved keyword in context replace_pics its array of objects which contains two attributes:
current_name - name of dummy picture already placed in template.url - link for picture which will replace dummy picture.example:
>>> context = {
... 'title': 'My company',
... 'phone': '+15552345712',
... 'replace_pics': [
... {'current_name': 'dummy_logo.png', 'url': '<link to your logo>'}
... ]
... }
Note: the aspect ratio will be the same as the replaced image
{{ iso_str_date | format_date}}{{ str_float_number | to_float}}{{ str_float_number | convert_amount_to_words}}{{ items_list | common_classification }}{{ items_list | common_classification_code}}{{ items_list | common_classification_description}}{{ classification_data | classification}}{{ data | json_query ('search_string')}}{{ data | default ('default')}}{{ unit_code | unit_shortcut}}{{ Image | InlineImage(width=50, height=50, unit=’mm’)}}python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pytest --cov
Content type
Image
Digest
Size
683.2 MB
Last updated
over 5 years ago
docker pull pontostroy/web-render