# Does anyone know how to generate PDF from text programmatically for invoices?

**URL:** <https://www.insumo.io/t/does-anyone-know-how-to-generate-pdf-from-text-programmatically-for-invoices/160>\
**Category:** Open Discussion\
**Created:** [November 11, 2026, 4:25am UTC](https://www.insumo.io/t/does-anyone-know-how-to-generate-pdf-from-text-programmatically-for-invoices/160 "2026-11-11T04:25:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrickGrant](https://www.insumo.io/letter_avatar_proxy/v4/letter/p/f14d63/32.png) [@PatrickGrant](https://www.insumo.io/u/PatrickGrant)\
**Post date:** [November 11, 2026, 4:25am UTC](https://www.insumo.io/t/does-anyone-know-how-to-generate-pdf-from-text-programmatically-for-invoices/160/1 "2026-11-11T04:25:09Z")

</div>

I’m trying to generate PDF invoices from text in a small billing script, but the spacing keeps shifting. How can I keep totals aligned and handle invoices that run onto a second page?

---

<div class="post-metadata">

**Author:** ![clumsy\_goblin](https://www.insumo.io/letter_avatar_proxy/v4/letter/c/5fc32e/32.png) [@clumsy\_goblin](https://www.insumo.io/u/clumsy_goblin)\
**Post date:** [November 11, 2026, 4:25am UTC](https://www.insumo.io/t/does-anyone-know-how-to-generate-pdf-from-text-programmatically-for-invoices/160/2 "2026-11-11T04:25:18Z")

</div>

To be fair, plain text coordinates always mess up spacing. The simplest thing is to use a basic HTML template with fixed table widths insted, then convert that to PDF. It handles page breaks and aligns totals automatically.
