Skip to content
//Markdown & HTML to PDF / Word Converter example\\

HTML invoice and a batch of documents

Prints an HTML invoice template and a list of HTML, Markdown and text documents as PDFs and Word files with a file name prefix.

Updated November 13, 2026

What this example returns

The dataset’s “Files” view shows 12 columns: Download, File, Format, Pages, Size (bytes), Title, Source, Source type, Words, Notes, Status, and Error. See every output field.

What each setting does

The input this example runs Markdown & HTML to PDF / Word Converter with. “Try this input” opens it in the console, where you can run it as-is or change any field first.

HTML html

<!DOCTYPE html><html><head><meta charset="utf-8"><title>Invoice 2026-0042</title> <style>body{font-family:Arial,sans-serif;color:#222}h1{color:#1d4ed8}table{width:100%;border-collapse:collapse}td,th{border-bottom:1px solid #ddd;padding:8px;text-align:left}.total{font-weight:bold}</style> </head><bo…

HTML to print as it is, with its own styles and scripts, e.g. an invoice or report template. Relative links use the Base URL below.

Output formats outputFormats

pdf, docx

Files to create from each document: PDF, Word (.docx), styled HTML or Markdown. Pick several to get each format; a format the source already has is skipped (a Word file is not turned into Word again).

Default: pdf → this example uses pdf, docx

Page numbers pageNumbers

No

Print 'page / total' at the bottom of every page. A custom footer below replaces it.

Default: Yes → this example uses No

One long page singlePage

Yes

Print the whole document on one tall page instead of splitting it into pages (up to 200 inches, the most a PDF page can hold).

Default: No → this example uses Yes

Custom CSS customCss

body { font-size: 13px; }

Extra CSS for every document and web page, e.g. body { font-size: 12pt } or .ads { display: none }.

Documents documents

{"name":"receipt-1001","html":"<h1>Receipt 1001</h1><p>Paid in full. Thank you!</p>"}, {"name":"meeting-notes","markdown":"# Meeting notes\n\n1. Budget approved\n2. Launch on Monday\n\n> Next meeting: Friday"}, {"name":"plain-letter","text":"Dear customer,\nyour order has shipped.\n\nBest regards\n…

A list of documents for API calls and batches, each with a name and one of markdown, html, text, url or base64 (a file), e.g. [{"name": "invoice-1001", "html": "Invoice 1001"}, {"name": "notes", "markdown": "# Notes"}].

File name prefix fileNamePrefix

batch

Optional prefix for the created file names, e.g. 'report' gives report-quarterly-update.pdf.

.json
{
  "html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>Invoice 2026-0042</title>\n<style>body{font-family:Arial,sans-serif;color:#222}h1{color:#1d4ed8}table{width:100%;border-collapse:collapse}td,th{border-bottom:1px solid #ddd;padding:8px;text-align:left}.total{font-weight:bold}</style>\n</head><body><h1>Invoice 2026-0042</h1><p>Northwind Supplies · Due 30 days</p>\n<table><tr><th>Item</th><th>Qty</th><th>Price</th></tr><tr><td>Desk lamp</td><td>2</td><td>$49.80</td></tr>\n<tr><td>Office chair</td><td>1</td><td>$149.00</td></tr><tr class=\"total\"><td>Total</td><td></td><td>$198.80</td></tr></table>\n<script>document.querySelector('p').textContent += ' · generated by script';</script></body></html>",
  "documents": [
    {
      "name": "receipt-1001",
      "html": "<h1>Receipt 1001</h1><p>Paid in full. Thank you!</p>"
    },
    {
      "name": "meeting-notes",
      "markdown": "# Meeting notes\n\n1. Budget approved\n2. Launch on Monday\n\n> Next meeting: Friday"
    },
    {
      "name": "plain-letter",
      "text": "Dear customer,\nyour order has shipped.\n\nBest regards\nSupport"
    },
    {
      "name": "faq.md",
      "base64": "IyBGQVEKCioqSG93IGZhc3QgaXMgZGVsaXZlcnk/KiogVHdvIGRheXMuCg=="
    }
  ],
  "outputFormats": [
    "pdf",
    "docx"
  ],
  "singlePage": true,
  "pageNumbers": false,
  "customCss": "body { font-size: 13px; }",
  "fileNamePrefix": "batch"
}

What it costs

You pay for the events the actor reports, such as each result or page it produces. Platform usage is included in the event prices: compute, proxies, browser and storage cost nothing extra.

  • File createdfrom $0.001464One created PDF, Word, HTML or Markdown file with its download link. Each output format of a document is its own file; documents that cannot be converted are free.
  • Actor startfrom $0.001275Charged once per run.

Full pricing

When to use this example

From the Markdown & HTML to PDF / Word Converter readme:

What if an image or a page does not load?

The file is still created; the row's warning says which images were missing. A page that cannot be opened gives an error row and is not charged.

Can I use my company's fonts and colours?

Yes: use customCss for PDF and HTML, and wordTemplateUrl (a .docx with your styles) for Word files.

Other ways to run Markdown & HTML to PDF / Word Converter

All examples of Markdown & HTML to PDF / Word Converter

About Markdown & HTML to PDF / Word Converter

Turn Markdown, HTML, web pages and Word files into polished PDF, Word (.docx), HTML or Markdown files. Tables, code highlighting, math, page numbers, headers and footers, table of contents and Word templates. Paste text, add links, upload files or convert a dataset.

Price:
From $1.46 / 1,000 results
Developer:
Toolwright

Markdown & HTML to PDF / Word Converter pageOutput fieldsPricing

Related actors

//From the blog\\

Latest articles

All articles

The internet is full of data.
Start owning yours.

Scrape.ly gives you the infrastructure, the tooling, and the team to extract, process, and operationalize web data at any scale. Setup takes minutes.

No credit card. No setup calls.