pdfgeneration / generate_pdf.py
gopichandra's picture
Update generate_pdf.py
d67611d verified
raw
history blame contribute delete
738 Bytes
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
def create_pdf(quote_data):
# Define file path for saving the PDF
file_name = "/mnt/data/quote_invoice.pdf"
# Create the PDF
c = canvas.Canvas(file_name, pagesize=letter)
# Add Quote Data to PDF
c.drawString(100, 750, f"Customer: {quote_data['records'][0]['Customer_Name__c']}")
c.drawString(100, 730, f"Quote Date: {quote_data['records'][0]['Quote_Date__c']}")
c.drawString(100, 710, f"Origination Location: {quote_data['records'][0]['Origination_Location__c']}")
c.drawString(100, 690, f"Total Amount: {quote_data['records'][0]['Total_Amount__c']}")
c.save() # Save the PDF
return file_name