Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iamtheritikraj/pdfgeneratorservice
https://github.com/iamtheritikraj/pdfgeneratorservice
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/iamtheritikraj/pdfgeneratorservice
- Owner: iamtheritikraj
- Created: 2024-10-24T15:44:30.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-10-24T16:16:51.000Z (2 months ago)
- Last Synced: 2024-10-25T21:37:06.684Z (2 months ago)
- Language: Java
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
PDF Generator Service
PDFGeneratorService is a Spring Boot application designed to generate PDF invoices that can be used via POSTMAN or Swagger UI.
It allows you to submit invoice data via a REST API and generate a downloadable PDF invoice.
The generated PDFs are stored locally, and if the same data is provided again, the system retrieves the existing PDF instead of regenerating it.How to Use
1. Download PDF
GET:api/pdf/download?fileName="example.pdf"
Use this endpoint to download an already generated PDF by providing thefileName
parameter in the query string.2. Generate PDF
POST:api/pdf/generate
Use this endpoint to generate a new PDF by providing the invoice data in the request body.Sample Request Body
{
"seller": "XYZ Pvt. Ltd.",
"sellerGstin": "29AABBCCDD121ZD",
"sellerAddress": "New Delhi, India",
"buyer": "Vedant Computers",
"buyerGstin": "29AABBCCDD131ZD",
"buyerAddress": "New Delhi, India",
"items": [
{
"name": "Product 1",
"quantity": "12 Nos",
"rate": 123.00,
"amount": 1476.00
}
]
}Required Header
Content-Type:
application/json
Features
- REST API to accept invoice data and generate a PDF based on the received information.
- Ability to download the generated PDF by providing the file name.
- Stores the generated PDF in local storage and retrieves it when the same data is provided again to avoid regeneration.
Technology Stack
-
Java: Programming language used to build the application. -
Spring Boot: Framework used to create the REST API service. -
Thymeleaf: Template engine used to generate HTML content for the PDF. -
iText: Library used to convert HTML content to a PDF document.
Endpoints
Method
URL
Description
GET
/api/pdf/download?fileName="example.pdf"
Download the PDF by file name.
POST
/api/pdf/generate
Generate a new PDF invoice by submitting invoice data.
Installation and Setup
- Clone the repository to your local machine.
- Open the project in your preferred IDE.
- Ensure you have Java 8+ and Maven installed.
- Run
mvn clean install
to build the project. - Run the application using
mvn spring-boot:run
.
License
This project is licensed under the MIT License.