Giter VIP home page Giter VIP logo

assignment1's Introduction

Dynamic-PDF-Generation

Dynamic PDF Generator

Problem Statement:

Build a Spring Boot Application with REST API to generate PDF using Java Template Engine.

Requirement

1 REST API to accept data and generate a PDF based on the received data.

2 Ability to download the above-generated PDF

Use Java Template Engines like Thymeleaf or iText to generate the PDF and store it on the local storage which can be retrieved later. The input should have a proper schema.

Example The request body of the API call looks something like this: { "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 } ] }

  • PDF Sample

image

Note ● Only REST APIs are required. No UI. ● Testable on Postman / Swagger. ● Will prefer properly structured code. ● Will prefer Test Cases (TDD)

Simple Documentation

  • Documentation for Spring Boot Application with REST API to Generate PDF using Java Template Engine

  • Introduction: This project is a simple implementation of a REST API in Spring Boot that accepts data in a specific format

and generates a PDF document based on the received data. The PDF document is generated using iText or Thymeleaf Java Template Engines.

The generated PDF document can be downloaded and stored locally.

Requirements:

  • The project has the following requirements:

A REST API that accepts data in a specific format.

The received data should be used to generate a PDF document.

The PDF document should be generated using either iText or Thymeleaf Java Template Engines.

The generated PDF document should be stored locally and should be retrievable later.

The input data should have a proper schema.

No UI is required, only REST APIs.

The project should be testable on Postman/Swagger.

The code should be properly structured.

Test cases should be implemented using Test Driven Development (TDD).

  • Dependencies:

The project has the following dependencies:

  • Spring Boot Starter Web

  • Spring Boot Starter Data JPA

  • MySQL Driver

  • iText PDF

  • Thymeleaf

  • Project Structure: The project structure is as follows:

The controller package contains the InvoiceController class, which is responsible for handling the REST API requests.

The service package contains the InvoiceService class, which is responsible for generating the PDF document.

The repository package contains the InvoiceRepository interface, which is responsible for storing the received data into a MySQL database.

The entity package contains the Invoice class, which represents the received data.

  • How to Use: To use the project, follow the steps below:

Clone the project from the GitHub repository.

Open the project in your preferred Java IDE.

Update the MySQL database configuration in the application.properties file.

Build the project using Maven.

Run the project.

Use Postman or Swagger to test the REST API.

The generated PDF document will be stored locally and can be retrieved later.

  • Conclusion:

This project is a simple implementation of a REST API in Spring Boot that generates a PDF document based on received data. It can be used as a starting point for more complex projects that require generating PDF documents using Java Template Engines.

assignment1's People

Contributors

misuraj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.