#[Web] Best way to generate and store PDF quote

1 messages · Page 1 of 1 (latest)

sullen hare
#

Hello! Im building a REST API using Spring/Boot, im in charge to create an endpoint to make user send quote email with PDF attachment. the pdf have to be generated based on a webpage in clientside, i dunno what to do here:

  • copy the web page template in my spring boot app source files?
  • make the client generates the pdf and send it as multipartfile?
  • build the pdf in backend without template, with java sdk (using tool like Apache pdfbox).

Im looking for the easiest and effective way peepo_think

fleet daggerBOT
#

<@&987246964494204979> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

generated dynamically based on the user's input and then stored for future reference. Here are the steps you can follow to achieve this:

  1. Generate PDF:

    • Use a library like iText or Apache PDFBox to generate the PDF document.
    • Design the layout of the quote using HTML/CSS and convert it to PDF using the library.
    • Populate the dynamic data from the user's input into the PDF document.
  2. Store PDF:

    • Choose a storage solution like Amazon S3, Google Cloud Storage, or a local file system.
    • Generate a unique filename for each PDF to avoid conflicts.
    • Save the generated PDF to the chosen storage location.
  3. Create REST API endpoint:

    • Define an endpoint in your Spring/Boot application that accepts user input for generating a quote.
    • Validate and process the user's input.
    • Generate and store the PDF as described above.
    • Attach the generated PDF to an email using JavaMail or a similar library.
    • Send the email with the attached quote PDF to the recipient.
  4. Optional: Implement authentication and authorization mechanisms to secure your API endpoint.

Remember to handle any errors gracefully and provide appropriate responses to your users.