Create a PDF with multiple Database Results

Post Reply
Calum459
Newbie
Posts: 3
Joined: Wed Mar 29, 2023 3:27 pm

Create a PDF with multiple Database Results

Post by Calum459 »

I am currently creating a Delivery note for one of our customers for their orders. They will be sending multiple products (separate PDFs) to us within one order, and I would like to add all of these to a single Delivery Note PDF.

Within the flow, I create Private Data from the names of the files and from the data the front-end user will enter at a submit point. I will be adding this to a database to a) record the orders we have been receiving. and B) to pull from to create different documents.

Is there a way to pull from the database all information relating to a specific number (PO Number) and add all of the data to a premade file that will enter the flow using Inject Job. I would set this up using a different add object within PitStop for each record of data but i'm not sure of any way this could be done any easier.
User avatar
JimmyHartington
Advanced member
Posts: 475
Joined: Tue Mar 22, 2011 7:38 am

Re: Create a PDF with multiple Database Results

Post by JimmyHartington »

I do not have the database module, but have in other case used a JSON-file of an order.
Then used the app "Create file from template" https://www0.enfocus.com/en/appstore/pr ... m-template to generate a HTML.
This HTML is then converted to pdf to get an order sheet.

So if you are able to extract the data from the database to a JSON-file you can use this approach.

Sample JSON:

Code: Select all

{
  "order_id": "ORD123456",
  "customer": {
    "customer_id": "CUST7890",
    "name": "John Doe",
    "email": "johndoe@example.com",
    "phone": "+1234567890",
    "address": {
      "street": "123 Printing Lane",
      "city": "Printville",
      "state": "CA",
      "zip_code": "90210",
      "country": "USA"
    }
  },
  "order_date": "2023-10-15",
  "status": "Processing",
  "line_items": [
    {
      "line_item_id": "LI001",
      "product": "Business Cards",
      "quantity": 500,
      "unit_price": 0.10,
      "total_price": 50.00,
      "specifications": {
        "size": "3.5 x 2 inches",
        "paper_type": "Matte",
        "color": "Full Color",
        "sides": "Double-sided"
      }
    },
    {
      "line_item_id": "LI002",
      "product": "Brochures",
      "quantity": 200,
      "unit_price": 0.75,
      "total_price": 150.00,
      "specifications": {
        "size": "8.5 x 11 inches",
        "paper_type": "Glossy",
        "color": "Full Color",
        "fold": "Tri-fold"
      }
    },
    {
      "line_item_id": "LI003",
      "product": "Posters",
      "quantity": 50,
      "unit_price": 2.00,
      "total_price": 100.00,
      "specifications": {
        "size": "24 x 36 inches",
        "paper_type": "Satin",
        "color": "Full Color"
      }
    }
  ],
  "subtotal": 300.00,
  "tax": 24.00,
  "shipping_cost": 15.00,
  "total": 339.00,
  "payment": {
    "method": "Credit Card",
    "transaction_id": "TXN654321",
    "status": "Paid"
  }
}
Sample pdf
https://d.pr/f/MDWy46

Flow
Royal TSX-Flow-server03-2025-08-04 at 14.35.50@2x.png
Royal TSX-Flow-server03-2025-08-04 at 14.35.50@2x.png (45.01 KiB) Viewed 909 times
Calum459
Newbie
Posts: 3
Joined: Wed Mar 29, 2023 3:27 pm

Re: Create a PDF with multiple Database Results

Post by Calum459 »

Thank you for the help, I will give this a go!

Is there a way within the Database Module alongside PitStop that you know of?
User avatar
JimmyHartington
Advanced member
Posts: 475
Joined: Tue Mar 22, 2011 7:38 am

Re: Create a PDF with multiple Database Results

Post by JimmyHartington »

You can use variables in Pitstop Server.
And these can be populated by data from Switch.
Look at this webinar: https://www.youtube.com/embed/KR_AG2_f7NE
And this latest one: https://learning.enfocus.com/course/view.php?id=608

But if you want to add multiple lines based on x amount of order lines you will probably hit a wall quickly.
Calum459
Newbie
Posts: 3
Joined: Wed Mar 29, 2023 3:27 pm

Re: Create a PDF with multiple Database Results

Post by Calum459 »

Perfect thank you for the help! Ill have a look at the JSON version!
Post Reply