Tuesday, October 6, 2026

How to Add a Custom Invoice Print Template in TallyPrime Using TDL

TallyPrime Release 7.1+ supports multiple invoice print templates. In this guide, we register an invoice format called OTS Simple GST Invoice and make it available in the invoice print view.

Before you begin
Test this TDL in TallyPrime Developer with a backup company. The supporting definitions VPC TMPL InvoiceFormatDocs, VPC TMPL Sales and OTS Simple GST Invoice Object Map must be available for your release.

Complete TDL code

;; =========================================================
;; OTS Simple GST Invoice Template
;; TallyPrime Release 7.1+
;; =========================================================

[#Collection: VPC TMPL Custom Formats]
    Object : OTS Simple GST Invoice Template

[Object: OTS Simple GST Invoice Template]
    Use              : VPC TMPL InvoiceFormatDocs
    Country          : @@TMPLCountryIndia
    ViewName         : "OTSSimpleGST"
    UserViewName     : "OTS Simple GST Invoice"
    VarProfile       : "OTS Simple GST Invoice Object Map"
    CarouselTitle    : "OTS Simple GST Invoice"
    IsDefaultAppView : No
    IsDefaultCmpView : Yes

[!Form: OTS Simple GST Invoice Form]
    Use : VPC TMPL Sales

[#Form: Printed Invoice]
    Add : Switch : At Beginning : OTSInvoiceSwitch : OTS Simple GST Invoice Form : +@@VPCTMPLSVPrintViewName = "OTSSimpleGST"

How the code works

1. Register the format: VPC TMPL Custom Formats makes the custom invoice format available to TallyPrime.

2. Define the template: The object assigns the internal view name OTSSimpleGST and the display name OTS Simple GST Invoice.

3. Map the variables: VarProfile connects the format to OTS Simple GST Invoice Object Map.

4. Use the sales form: The custom form inherits VPC TMPL Sales.

5. Switch the print view: The Printed Invoice switch activates this form when the current print view equals OTSSimpleGST.

How to load and test

  1. Open TallyPrime Developer and create a separate TDL file.
  2. Paste the complete code without changing the internal names.
  3. Confirm that the supporting template definitions and object map are loaded.
  4. Load the TDL in a test company.
  5. Open a Sales voucher and select Print Preview.
  6. Look for OTS Simple GST Invoice in the print-template or print-view options.
  7. Test the company, buyer, invoice number, date, items, HSN/SAC, GST values and totals.
  8. Test local GST, interstate GST, credit notes, multiple items and multi-page invoices.

Create additional invoice designs

Use unique names for every design. For example: OTSCompactGST, OTSModernGST and OTSRetailGST. Each design should have its own ViewName, UserViewName, CarouselTitle, VarProfile and switch condition.

Design ideas
Add a logo, GSTIN, buyer and shipping details, HSN/SAC, quantity, rate, discount, CGST, SGST, IGST, round-off, amount in words, bank details, terms and an authorised-signatory section.

Troubleshooting

  • Template does not appear: confirm that the object is added to VPC TMPL Custom Formats and that the TDL loaded successfully.
  • Default invoice still prints: verify that the active print view is OTSSimpleGST and that the Printed Invoice switch is evaluated.
  • Fields are blank: check the object map and supporting field mappings.
  • Errors appear after an upgrade: compare the VPC TMPL definitions with the current TallyPrime release.
  • Multiple templates conflict: use unique object, form, switch, view and profile names.

Conclusion

This method adds a named custom invoice template while keeping TallyPrime's default format available. Test the template in Developer mode first, then build additional designs as separate template objects. Always keep a backup of each working TDL version.

No comments:

Post a Comment