If you like htmldocs, please consider giving it a star onGitHub

htmldocs is a React library for
building and generating documents

Create dynamic invoices, reports, and contracts using modern web technologies. Design once with JSX, then generate thousands of PDFs just by passing props.

Invoice
INV_Z45LSH3A

Issued

Jun 17, 2026

Due

Jun 24, 2026

Billed To

Cookie Monster

123 Sesame Street

New York, NY 10036

123-1234-1234

From

Ridegeek

123 Pedalgear Ave

San Francisco, CA 94210

ItemQtyPriceLine total
Chocolate chip cookieReally yummy!
1$4.50$4.50
White macadamia cookieA bit more unique
2$4.50$9.00
Subtotal$13.50
Tax (12%)$1.62
Total$15.12
Amount due$15.12
function Invoice({ customer, items }) {
  const invoiceId = generateId()
  const issueDate = formatDate(new Date())

  // 7 days from now
  const dueDate = formatDate(Date.now() + 7 * 24 * 60 * 60 * 1000)

  return (
    <Document size="A4" orientation="portrait" margin="0.5in">
      <Page>
        <div className="flex flex-col h-full space-y-3">
          <div className="flex items-center justify-between">
            <div className="flex flex-col">
              <div className="text-black text-lg font-semibold leading-tight">
                Invoice
              </div>
              <div className="text-gray-500 text-[10px]">
                {invoiceId}
              </div>
            </div>
            <img src="logo.svg" />
          </div>

          <Header
            issueDate={issueDate}
            dueDate={dueDate}
            customer={customer}
          />

          <ItemsTable items={items} />

          <div className="h-full flex-1"></div>

          <Footer />
        </div>
      </Page>
    </Document>
  )
}