-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The current implementation of the document generator which generates a Word or Pdf document depending on the template requires manual unzipping a Word file and extracting a xml document. Generating a Word or Pdf file from a template is a common task that can be useful to many users. Therefore, this feature can be extracted in another independent library with the following API.
document_generator = DocumentGenerator(
template='document_template.docx',
name='my_document',
output_dir='~/documents',
variables={'variable1': 'value1', 'variable2': 'value2'}
)
word_path1 = document_generator.generate_docx()
# word_path1 = '/home/user/documents/my_document.docx'
word_path2 = document_generator.generate_docx(
name='another_document',
output_dir='~/another_documents/',
variables={'variable1': 'value1', 'variable2': 'value2'}
)
# word_path2 = '/home/user/documents/another_document.docx'
pdf_path = document_generator.generate_pdf()
# pdf_path = '/home/user/documents/my_document.pdf'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request