diff --git a/public/examples.html b/public/examples.html new file mode 100644 index 0000000..bbf5fd2 --- /dev/null +++ b/public/examples.html @@ -0,0 +1,359 @@ + + + + + +Code Examples — DocFast HTML to PDF API + + + + + + + + + + + + + + + + + + +
+
+ +
+

Code Examples

+

Practical examples for generating PDFs with the DocFast API — invoices, reports, receipts, and integration guides.

+
+ + + + +
+

Generate an Invoice PDF

+

Create a professional invoice with inline CSS and convert it to PDF with a single API call.

+ +
+ HTML — invoice.html +
<html>
+<body style="font-family: sans-serif; padding: 40px; color: #333;">
+  <div style="display: flex; justify-content: space-between;">
+    <div>
+      <h1 style="margin: 0; color: #111;">INVOICE</h1>
+      <p style="color: #666;">#INV-2026-0042</p>
+    </div>
+    <div style="text-align: right;">
+      <strong>Acme Corp</strong><br>
+      123 Main St<br>
+      hello@acme.com
+    </div>
+  </div>
+
+  <table style="width: 100%; border-collapse: collapse; margin-top: 40px;">
+    <tr style="border-bottom: 2px solid #111;">
+      <th style="text-align: left; padding: 8px 0;">Item</th>
+      <th style="text-align: right; padding: 8px 0;">Qty</th>
+      <th style="text-align: right; padding: 8px 0;">Price</th>
+    </tr>
+    <tr style="border-bottom: 1px solid #eee;">
+      <td style="padding: 12px 0;">API Pro Plan (monthly)</td>
+      <td style="text-align: right;">1</td>
+      <td style="text-align: right;">$49.00</td>
+    </tr>
+    <tr>
+      <td style="padding: 12px 0;">Extra PDF renders (500)</td>
+      <td style="text-align: right;">500</td>
+      <td style="text-align: right;">$15.00</td>
+    </tr>
+  </table>
+
+  <p style="text-align: right; font-size: 1.4em; margin-top: 24px;">
+    <strong>Total: $64.00</strong>
+  </p>
+</body>
+</html>
+
+ +
+ curl +
curl -X POST https://api.docfast.dev/v1/convert/html \
+  -H "Authorization: Bearer YOUR_API_KEY" \
+  -H "Content-Type: application/json" \
+  -d '{"html": "<html>...your invoice HTML...</html>"}' \
+  --output invoice.pdf
+
+
+ + +
+

Convert Markdown to PDF

+

Send Markdown content directly — DocFast renders it with clean typography and outputs a styled PDF.

+ +
+ curl +
curl -X POST https://api.docfast.dev/v1/convert/markdown \
+  -H "Authorization: Bearer YOUR_API_KEY" \
+  -H "Content-Type: application/json" \
+  -d '{
+    "markdown": "# Project Report\n\n## Summary\n\nQ4 revenue grew **32%** year-over-year.\n\n## Key Metrics\n\n| Metric | Value |\n|--------|-------|\n| Revenue | $1.2M |\n| Users | 45,000 |\n| Uptime | 99.97% |\n\n## Next Steps\n\n1. Launch mobile SDK\n2. Expand EU infrastructure\n3. SOC 2 certification"
+  }' \
+  --output report.pdf
+
+
+ + +
+

HTML Report with Charts

+

Embed inline SVG charts in your HTML for data-driven reports — no JavaScript or external libraries needed.

+ +
+ HTML — report with SVG bar chart +
<html>
+<body style="font-family: sans-serif; padding: 40px;">
+  <h1>Quarterly Revenue</h1>
+
+  <svg width="400" height="200" viewBox="0 0 400 200">
+    <!-- Bars -->
+    <rect x="20"  y="120" width="60" height="80"  fill="#34d399"/>
+    <rect x="110" y="80"  width="60" height="120" fill="#34d399"/>
+    <rect x="200" y="50"  width="60" height="150" fill="#34d399"/>
+    <rect x="290" y="20"  width="60" height="180" fill="#34d399"/>
+    <!-- Labels -->
+    <text x="50"  y="115" text-anchor="middle" font-size="12">$80k</text>
+    <text x="140" y="75"  text-anchor="middle" font-size="12">$120k</text>
+    <text x="230" y="45"  text-anchor="middle" font-size="12">$150k</text>
+    <text x="320" y="15"  text-anchor="middle" font-size="12">$180k</text>
+  </svg>
+</body>
+</html>
+
+ +
+ curl +
curl -X POST https://api.docfast.dev/v1/convert/html \
+  -H "Authorization: Bearer YOUR_API_KEY" \
+  -H "Content-Type: application/json" \
+  -d @report.json \
+  --output chart-report.pdf
+
+
+ + +
+

Receipt / Confirmation PDF

+

Generate a simple receipt or order confirmation — perfect for e-commerce and SaaS billing.

+ +
+ HTML — receipt template +
<html>
+<body style="font-family: sans-serif; max-width: 400px; margin: 0 auto; padding: 40px;">
+  <div style="text-align: center; margin-bottom: 24px;">
+    <h2 style="margin: 0;">Payment Receipt</h2>
+    <p style="color: #888;">Feb 20, 2026</p>
+  </div>
+
+  <hr style="border: none; border-top: 1px dashed #ccc;">
+
+  <p><strong>Order:</strong> #ORD-98712</p>
+  <p><strong>Customer:</strong> jane@example.com</p>
+
+  <table style="width: 100%; margin: 16px 0;">
+    <tr>
+      <td>Pro Plan</td>
+      <td style="text-align: right;">$29.00</td>
+    </tr>
+    <tr>
+      <td>Tax</td>
+      <td style="text-align: right;">$2.90</td>
+    </tr>
+  </table>
+
+  <hr style="border: none; border-top: 1px dashed #ccc;">
+
+  <p style="text-align: right; font-size: 1.3em;">
+    <strong>Total: $31.90</strong>
+  </p>
+  <p style="text-align: center; color: #34d399; margin-top: 24px;">
+    ✓ Payment successful
+  </p>
+</body>
+</html>
+
+
+ + +
+

Node.js Integration

+

A complete Node.js script to generate a PDF and save it to disk. Works with Node 18+ using native fetch.

+ +
+ JavaScript — generate-pdf.mjs +
const html = `
+  <h1>Hello from Node.js</h1>
+  <p>Generated at ${new Date().toISOString()}</p>
+`;
+
+const res = await fetch("https://api.docfast.dev/v1/convert/html", {
+  method: "POST",
+  headers: {
+    "Authorization": `Bearer ${process.env.DOCFAST_API_KEY}`,
+    "Content-Type": "application/json",
+  },
+  body: JSON.stringify({ html }),
+});
+
+if (!res.ok) throw new Error(`API error: ${res.status}`);
+
+const buffer = Buffer.from(await res.arrayBuffer());
+await import("fs").then(fs =>
+  fs.writeFileSync("output.pdf", buffer)
+);
+
+console.log("✓ Saved output.pdf");
+
+
+ + +
+

Python Integration

+

Generate a PDF from Python using the requests library. Drop this into any Flask, Django, or FastAPI app.

+ +
+ Python — generate_pdf.py +
import os
+import requests
+
+html = """
+<h1>Hello from Python</h1>
+<p>This PDF was generated via the DocFast API.</p>
+<ul>
+  <li>Fast rendering</li>
+  <li>Pixel-perfect output</li>
+  <li>Simple REST API</li>
+</ul>
+"""
+
+response = requests.post(
+    "https://api.docfast.dev/v1/convert/html",
+    headers={
+        "Authorization": f"Bearer {os.environ['DOCFAST_API_KEY']}",
+        "Content-Type": "application/json",
+    },
+    json={"html": html},
+)
+
+response.raise_for_status()
+
+with open("output.pdf", "wb") as f:
+    f.write(response.content)
+
+print("✓ Saved output.pdf")
+
+
+ +
+
+ + + + + diff --git a/public/impressum.html b/public/impressum.html index 5907197..191cf16 100644 --- a/public/impressum.html +++ b/public/impressum.html @@ -8,6 +8,9 @@ + + + @@ -23,7 +26,7 @@ body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Robo a { color: var(--accent); text-decoration: none; transition: color 0.2s; } a:hover { color: var(--accent-hover); } .container { max-width: 800px; margin: 0 auto; padding: 0 24px; } -nav { padding: 20px 0; border-bottom: 1px solid var(--border); } +nav { padding: 20px 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 100; } nav .container { display: flex; align-items: center; justify-content: space-between; } .logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.5px; color: var(--fg); display: flex; align-items: center; gap: 8px; text-decoration: none; } .logo span { color: var(--accent); } @@ -47,14 +50,15 @@ footer .container { display: flex; justify-content: space-between; align-items: footer .container { flex-direction: column; text-align: center; } .nav-links { gap: 16px; } } -/* Skip to content */ -.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #0b0d11; padding: 8px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 0.9rem; z-index: 200; transition: top 0.2s; } + +.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; } +.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #0b0d11; padding: 8px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 0.9rem; z-index: 200; transition: top 0.2s; text-decoration: none; } .skip-link:focus { top: 0; } - + -
+

Impressum

Legal notice according to § 5 ECG and § 25 MedienG (Austrian law)

@@ -103,8 +108,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
diff --git a/public/privacy.html b/public/privacy.html index a0d2055..43ae51b 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -8,6 +8,9 @@ + + + @@ -23,7 +26,7 @@ body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Robo a { color: var(--accent); text-decoration: none; transition: color 0.2s; } a:hover { color: var(--accent-hover); } .container { max-width: 800px; margin: 0 auto; padding: 0 24px; } -nav { padding: 20px 0; border-bottom: 1px solid var(--border); } +nav { padding: 20px 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 100; } nav .container { display: flex; align-items: center; justify-content: space-between; } .logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.5px; color: var(--fg); display: flex; align-items: center; gap: 8px; text-decoration: none; } .logo span { color: var(--accent); } @@ -47,14 +50,15 @@ footer .container { display: flex; justify-content: space-between; align-items: footer .container { flex-direction: column; text-align: center; } .nav-links { gap: 16px; } } -/* Skip to content */ -.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #0b0d11; padding: 8px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 0.9rem; z-index: 200; transition: top 0.2s; } + +.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; } +.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #0b0d11; padding: 8px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 0.9rem; z-index: 200; transition: top 0.2s; text-decoration: none; } .skip-link:focus { top: 0; } - + -
+

Privacy Policy

Last updated: February 16, 2026

@@ -185,8 +190,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
diff --git a/public/terms.html b/public/terms.html index b950ea7..33a777c 100644 --- a/public/terms.html +++ b/public/terms.html @@ -8,6 +8,9 @@ + + + @@ -23,7 +26,7 @@ body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Robo a { color: var(--accent); text-decoration: none; transition: color 0.2s; } a:hover { color: var(--accent-hover); } .container { max-width: 800px; margin: 0 auto; padding: 0 24px; } -nav { padding: 20px 0; border-bottom: 1px solid var(--border); } +nav { padding: 20px 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 100; } nav .container { display: flex; align-items: center; justify-content: space-between; } .logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.5px; color: var(--fg); display: flex; align-items: center; gap: 8px; text-decoration: none; } .logo span { color: var(--accent); } @@ -47,14 +50,15 @@ footer .container { display: flex; justify-content: space-between; align-items: footer .container { flex-direction: column; text-align: center; } .nav-links { gap: 16px; } } -/* Skip to content */ -.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #0b0d11; padding: 8px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 0.9rem; z-index: 200; transition: top 0.2s; } + +.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; } +.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #0b0d11; padding: 8px 16px; border-radius: 0 0 8px 8px; font-weight: 600; font-size: 0.9rem; z-index: 200; transition: top 0.2s; text-decoration: none; } .skip-link:focus { top: 0; } - + -
+

Terms of Service

Last updated: February 16, 2026

@@ -145,7 +150,7 @@ footer .container { display: flex; justify-content: space-between; align-items:

5.2 Performance

@@ -257,8 +262,7 @@ footer .container { display: flex; justify-content: space-between; align-items: