Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To generate a GST invoice PDF from your website, build the invoice HTML on your server, send it in an authenticated JSON POST request to https://api.html2pdf.app/v1/generate, then save or stream the successful response as a PDF. Keep the Html2Pdf.app API key on the server. A PDF conversion is only the document-rendering step: it does not register an invoice or complete any e-invoice reporting that may apply to your business.

What you need before generating the PDF

  • A server-side route or job that receives invoice data from your website and builds the HTML. Do not put the Html2Pdf.app API key in browser JavaScript, a public repository, or a client-side template.
  • An Html2Pdf.app API key stored in server-side configuration.
  • An invoice template configured for the taxpayer and transaction. GST invoice particulars depend on the circumstances; a generic template is not automatically compliant for every supply.

The documented endpoint accepts either raw HTML or a page URL. Raw HTML is the natural choice when your application assembles invoice content privately. Use a URL when the conversion service can reach the page and its CSS, fonts, images, and other resources.

Include the applicable GST invoice particulars

CBIC Rule 46 lists particulars including supplier name, address and GSTIN; a consecutive serial number unique for the financial year; the issue date; recipient details as applicable; HSN code for goods or accounting code for services; description; quantity and unit for goods; total and taxable supply value; tax rates and tax amounts; and conditional information such as place of supply, delivery address, reverse-charge status and supplier signature. Section 31 of the CGST Act addresses the obligation to issue tax invoices for taxable supplies and the prescribed information.

Some particulars and exceptions are conditional. Configure the template against the current rules and amendments for the taxpayer and transaction rather than treating this list as legal advice. The GSTN-hosted 2025 e-invoice brochure describes Invoice Registration Portal functionality and reporting of applicable invoice details in a notified format. The sources cited here do not establish which taxpayers or transactions are subject to e-invoicing; check current official rules for applicability. Generating a human-readable PDF alone does not show that an applicable invoice was registered or reported through an IRP.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)

Generate a PDF synchronously with the API

Html2Pdf.app documents a JSON POST to https://api.html2pdf.app/v1/generate, with the HTML in the request body and the API key in the X-API-Key header. A successful synchronous response contains PDF binary data. Check the HTTP status before treating the response body as a PDF.

Example invoice HTML

Build the document from validated invoice data on your backend. This minimal structural example uses illustrative text, not a complete or universally compliant GST invoice:

Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <style>
    body { font: 12px Arial, sans-serif; color: #222; }
    table { border-collapse: collapse; width: 100%; }
    th, td { border: 1px solid #bbb; padding: 6px; text-align: left; }
  </style>
</head>
<body>
  <h1>Tax Invoice</h1>
  <p>Supplier: [configured supplier details]</p>
  <p>Invoice no.: [financial-year serial] | Date: [issue date]</p>
  <table>
    <thead><tr><th>Description</th><th>HSN/SAC</th><th>Taxable value</th><th>Tax</th></tr></thead>
    <tbody><tr><td>[item or service]</td><td>[applicable code]</td><td>[amount]</td><td>[rate and amount]</td></tr></tbody>
  </table>
</body>
</html>

Replace bracketed text using properly escaped invoice data. Include recipient, quantity, supply values, applicable tax breakdown and conditional particulars as required for the transaction.

cURL

Set the key in the server environment, then post JSON and write the response to a file. The request shape follows Html2Pdf.app’s documented endpoint and authentication method:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
export HTML2PDF_API_KEY='YOUR_API_KEY'
curl -sS -f -X POST 'https://api.html2pdf.app/v1/generate' 
  -H "X-API-Key: $HTML2PDF_API_KEY" 
  -H 'Content-Type: application/json' 
  --data-binary @- 
  -o invoice.pdf <<'JSON'
{"html":"<html><body><h1>Tax Invoice</h1><p>Invoice no.: INV-001</p></body></html>"}
JSON

For production, serialize the actual server-generated invoice HTML as JSON rather than hand-writing a quoted string. The -f option makes cURL fail on an HTTP error instead of silently saving an error response as though it were a PDF.

Python

import os
import requests

api_key = os.environ["HTML2PDF_API_KEY"]
html = "<html><body><h1>Tax Invoice</h1><p>Invoice no.: INV-001</p></body></html>"

response = requests.post(
    "https://api.html2pdf.app/v1/generate",
    headers={"X-API-Key": api_key},
    json={"html": html},
    timeout=90,
)
response.raise_for_status()
with open("invoice.pdf", "wb") as pdf_file:
    pdf_file.write(response.content)

Node.js

const apiKey = process.env.HTML2PDF_API_KEY;
if (!apiKey) throw new Error("Set HTML2PDF_API_KEY on the server");

const html = "<html><body><h1>Tax Invoice</h1><p>Invoice no.: INV-001</p></body></html>";
const response = await fetch("https://api.html2pdf.app/v1/generate", {
  method: "POST",
  headers: {
    "X-API-Key": apiKey,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ html })
});
if (!response.ok) {
  throw new Error(`PDF generation failed: HTTP ${response.status}`);
}
const pdf = Buffer.from(await response.arrayBuffer());
await import("node:fs/promises").then(fs => fs.writeFile("invoice.pdf", pdf));

These examples illustrate the documented request fields and binary response handling. Check the current Html2Pdf.app API endpoint documentation for supported options and any changes to the request contract.

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Choose synchronous generation or a callback

Synchronous response

Use the synchronous flow when the website can wait for the conversion request to finish. A successful response contains the PDF bytes; your backend can save them, attach them to a response, or store them for later retrieval. There is no universal latency threshold in the documentation for deciding when to switch approaches.

Asynchronous callback

For longer-running work, Html2Pdf.app documents a callBackUrl flow. Its example returns HTTP 202 when a job is accepted. That means the job was queued, not that a PDF is present in the initial response body. The callback later sends the document payload to the supplied endpoint. Your application should keep the invoice/job association so it can match the later document to the right customer and invoice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP LaserJet M110w Wireless Black & White Printer, Print, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate layout and protect the document pipeline

  • Generate representative invoices, including longer descriptions and conditional fields, and inspect the resulting pages before using the template in production.
  • Ensure a URL-based input and its CSS, fonts and images are accessible to the conversion service. Missing or inaccessible resources can produce blank output or missing styling.
  • Check CSS media selection and JavaScript load timing: both can change what is rendered. Avoid depending on late-loading content unless the rendering setup reliably waits for it.
  • Validate the HTTP status before storing or returning bytes. In the callback flow, distinguish the initial accepted response from the later document delivery.
  • Keep invoice data and the API key server-side. Return the generated document only to an authorized user, and avoid exposing the key in browser code or logs.

Common problems and fixes

Symptom Likely cause What to do
Authentication request fails The key is absent, invalid, or not sent in the documented header. Verify server configuration and send the key as X-API-Key. Do not move it into client-side code.
Saved file is not a usable PDF An HTTP error body was saved as if it were the document, or the response was not checked. Check status before saving or streaming the binary response; inspect the error response separately.
Blank page or missing styles The renderer cannot reach the page or its CSS, fonts, or images, or the selected media/render timing differs from expectations. Confirm resources are accessible, review media selection, and ensure required JavaScript content has loaded before capture.
Callback job appears to have no PDF The initial HTTP 202 is an acceptance response, not the completed PDF. Wait for the callback at the configured endpoint and associate its payload with the queued invoice job.
Invoice appears complete but e-invoice status is uncertain PDF rendering does not establish IRP registration or reporting. Check whether the taxpayer and transaction require e-invoicing under current official rules, then complete the applicable reporting workflow separately.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not a GST invoice PDF generator or a replacement for Html2Pdf.app. If you also need an image preview of a rendered invoice page, its API can capture a URL; the request is a single GET. For invoice PDFs, use the PDF workflow above. See the ScreenshotNeo website and API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/invoice/INV-001 -o invoice-preview.webp

ScreenshotNeo removes cookie banners, newsletter popups and chat widgets before a shot; bot checks, blank pages and failed loads are never billed. It includes an MCP server for AI agents. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does generating a PDF automatically create an IRN?

No. PDF rendering is a document-generation step; whether IRP reporting applies and how to complete it must be determined separately under current official rules.

Can I pass a webpage URL instead of HTML?

Yes. Html2Pdf.app documents both raw HTML and URL input; a URL-based page and its required resources must be reachable by the service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.