Releases: m4nd0mb3/document-templater
v0.2.0-alpha
Version Tag:
v0.2.0
New Features and Improvements:
-
Delete Templates: Easily remove registered templates directly within Document Templater.
-
Custom Output Format: Define the output format of the generated document, providing more flexibility to your needs.
-
Reference Refactoring: The file reference has been optimized to contain only the UUID, enhancing template management.
-
Output Format Validation: Ensure that the selected output format is compatible with the chosen file or template.
-
Swagger Integration: Added interactive API documentation for Document Templater using Swagger.
We appreciate everyone who contributed to this release. Try out the enhancements and new features now!
Document Templater Team
Release 0.1.0: Empowering Document Generation and Templating
🤖 Document Templater - Template Based Document Generation Microservice
Document Templater is a powerful and flexible microservice designed to simplify the generation of complex, personalised documents from predefined templates. Combining ease of use with the ability to create highly personalised documents, this microservice is ideal for automating the process of generating reports, contracts, forms and more.
Table of content
README idiomas: 🇦🇴 Português, 🇺🇸 English
How It Works
Document Templater leverages the Carbone library to merge templates with data, producing the desired output documents. It utilizes Node.js and Express.js for the backend, allowing you to build a robust and customizable document generation service.
The core features of Document Templater include:
- 📝 Generate professional, elegant documents from pre-loaded templates.
- 🎨 Easily customise documents by incorporating specific data.
- 🌈 Support for multiple template formats, including Word (docx) and PDF.
- 🍏 Simple integration with external APIs to fetch data in real time.
- ⭐️ Flexible settings to adjust the appearance and content of documents.
- 📐 Intuitive API that allows seamless integration into your existing projects.
Document Templater offers a scalable and efficient solution to meet your document generation needs, saving you time and ensuring consistent, high-quality results.
Bring document generation to life easily and reliably with Document Templater.
Getting Started
Follow these steps to get started with Document Templater:
Prerequisites
- Node.js: Make sure you have Node.js installed on your machine.
- LibreOffice: Make sure you have LibreOffice version 7.5.1.1 installed on your machine.
Installation
-
Clone the repository:
git clone https://github.com/m4nd0mb3/document-templater.git
-
Navigate to the project directory:
cd document-templater
-
Install dependencies:
npm install
Usage
-
Start the server:
npm start
-
Open your web browser and navigate to http://localhost:3000.
-
Explore the provided endpoints and examples to see how to generate different types of documents.
Running with Docker
To run Document Templater using Docker, follow these steps:
-
Build the Docker image:
docker build -t document-templater:latest .
-
Run the Docker container:
docker run -p 3000:3000 -d document-templater:latest
-
Open your web browser and navigate to http://localhost:3000.
Basic Endpoints
Document Templater provides a set of basic endpoints to interact with the document generation service. Below are the examples of how to use these endpoints.
Create Document Template
Endpoint: api/v1/document/create
Method: POST
Description: Create or save a template document based on a provided template and data. Only document file field is required all others will be used to test the data in the sandbox.
Request Body:
{
"document": "path/to/pdf-template.docx",
"data":{
"firstname": "John",
"lastname": "Doe"
}
}
Response:
{
"message":"Data inserted successfully!"
}
List All Document Template
Endpoint: api/v1/documents
Method: GET
Description: List all templates stored. Look that the string on tests_data we gonna use to test our sandbox...
Request Body:
{
}
Response:
{
"message": "success",
"data": [
{
"reference": "3da7aa72-0760-4b56-9ba6-efa337c1db2b.odt",
"name": "simple",
"tests_data": "{\"firstname\":\"rasmushed\",\"lastname\":\"Igor\",\"age\":\"30\"}"
},
{
"reference": "fbc57e45-6cbd-4250-8616-1e5038b01ad5.pptx",
"name": "Capa Envelope SV",
"tests_data": "{\"title\":\"Test PPTX\"}"
}
]
}
Test Our Document Template
Endpoint: api/v1/document/{reference}/sandbox
Method: GET
Description: Generates a PDF document based on a reference provided template and data.
Request Body: Optional, but if you enter, the body data must to have the sabe key structure with tests_data.
Response:
A generated PDF document.
Generate Document Template
Endpoint: api/v1/document/{reference}/generate
Method: GET
Description: Generates a PDF document based on a reference provided template and data.
Request Body: Dhe body data must to have the sabe key structure with tests_data.
Response:
A generated PDF document.
Configuration
Modify the configuration in .env
to customize settings such as port, file paths, and more.
Contributing
Contributions are welcome! If you encounter issues or want to add new features, feel free to submit a pull request.
License
This project is licensed under the Apache-2.0 License.