Ask AI
Skip to main content

Create pdf from docx

Function: Create PDF from DOCX

This action allows you to automatically generate a PDF document from a pre-designed DOCX template. You can populate this template with dynamic information, such as customer details, report data, or contract terms, and then save the resulting PDF directly into your application's media library.

Input,

  • Template (A piece of text): The name or identifier of the DOCX template you want to use for generating the PDF. This template should already exist in your application.
  • Data (A list of key/value pairs): The information you want to insert into the placeholders within your chosen template. This could be details from a database record, user input, or other variables in your application.
  • Media name (A piece of text): The desired name for the new PDF file that will be created and stored in your media library.

Output,

  • Result Variable Name (A piece of text): This is the name of a variable that will be created or updated in your application's memory. This variable will hold the unique ID of the newly generated PDF file in your media library, allowing you to reference it in subsequent actions (e.g., to send it via email or display it).

Execution Flow,

Real-Life Examples,

Example 1: Generating a Customer Invoice

Imagine you have an order management system and you want to automatically generate a PDF invoice once an order is marked as "completed."

  • Inputs:
    • Template: "InvoiceTemplate"
    • Data:
      \{
      "invoiceNumber": "INV-2023-001",
      "customerName": "Acme Corp",
      "customerAddress": "123 Main St, Anytown",
      "items": [
      \{"description": "Product A", "quantity": 2, "price": 10.00\},
      \{"description": "Product B", "quantity": 1, "price": 25.00\}
      ],
      "totalAmount": 45.00
      \}
    • Media name: "Invoice_INV-2023-001"
    • Result Variable Name: "generatedInvoiceId"
  • Result: A new PDF invoice named "Invoice_INV-2023-001" is created in your media library, containing all the customer and order details. The unique ID of this PDF is stored in the variable generatedInvoiceId, which you can then use to attach the invoice to an email or link it to the order record.

Example 2: Creating an Employee Offer Letter

When a new candidate accepts a job offer, you want to automatically generate a personalized offer letter in PDF format.

  • Inputs:
    • Template: "OfferLetterTemplate"
    • Data:
      \{
      "candidateName": "Jane Doe",
      "position": "Software Engineer",
      "salary": "80,000 USD",
      "startDate": "2024-01-15",
      "managerName": "John Smith"
      \}
    • Media name: "OfferLetter_JaneDoe_SoftwareEngineer"
    • Result Variable Name: "offerLetterDocId"
  • Result: A personalized PDF offer letter for Jane Doe is generated and saved as "OfferLetter_JaneDoe_SoftwareEngineer" in your media library. The ID of this document is stored in the offerLetterDocId variable, ready to be sent to the candidate.

Example 3: Producing a Monthly Sales Report

At the end of each month, you need to generate a PDF summary of sales performance for your team.

  • Inputs:
    • Template: "MonthlySalesReportTemplate"
    • Data:
      \{
      "reportMonth": "October 2023",
      "totalSales": 150000.00,
      "topProduct": "Product X",
      "regionalBreakdown": [
      \{"region": "North", "sales": 50000\},
      \{"region": "South", "sales": 40000\},
      \{"region": "East", "sales": 35000\},
      \{"region": "West", "sales": 25000\}
      ]
      \}
    • Media name: "Sales_Report_October_2023"
    • Result Variable Name: "monthlyReportId"
  • Result: A PDF sales report for October 2023 is created, containing all the specified sales figures and details. This report is saved as "Sales_Report_October_2023" in your media library, and its unique ID is stored in the monthlyReportId variable for easy access and distribution.