feat: add URL-to-PDF examples to examples page
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled

- Add 'URL to PDF' nav link and example section
- Show basic and advanced cURL examples for /v1/convert/url
- Include security notes (JS disabled, private URLs blocked)
- Add test coverage for the new section
This commit is contained in:
Hoid 2026-03-05 17:03:23 +01:00
parent 503e65103e
commit c233f289c9
3 changed files with 97 additions and 0 deletions

View file

@ -111,6 +111,7 @@ footer .container { display: flex; justify-content: space-between; align-items:
<a href="#markdown">Markdown</a>
<a href="#charts">Charts</a>
<a href="#receipt">Receipt</a>
<a href="#url-to-pdf">URL to PDF</a>
<a href="#nodejs">Node.js</a>
<a href="#python">Python</a>
<a href="#go">Go</a>
@ -270,6 +271,36 @@ footer .container { display: flex; justify-content: space-between; align-items:
</div>
</section>
<!-- URL to PDF -->
<section id="url-to-pdf" class="example-section">
<h2>URL to PDF</h2>
<p>Capture a live webpage and convert it to PDF. Send a URL to the <code>/v1/convert/url</code> endpoint and get a rendered PDF back. JavaScript is disabled for security (SSRF protection), and private/internal URLs are blocked.</p>
<div class="code-block">
<span class="code-label">curl — basic</span>
<pre><code>curl -X POST https://docfast.dev/v1/convert/url \
-H <span class="str">"Authorization: Bearer YOUR_API_KEY"</span> \
-H <span class="str">"Content-Type: application/json"</span> \
-d <span class="str">'{"url": "https://example.com"}'</span> \
--output page.pdf</code></pre>
</div>
<div class="code-block">
<span class="code-label">curl — with options</span>
<pre><code>curl -X POST https://docfast.dev/v1/convert/url \
-H <span class="str">"Authorization: Bearer YOUR_API_KEY"</span> \
-H <span class="str">"Content-Type: application/json"</span> \
-d <span class="str">'{
"url": "https://example.com",
"format": "A4",
"margin": { "top": "20mm", "bottom": "20mm" },
"scale": 0.8,
"printBackground": true
}'</span> \
--output page.pdf</code></pre>
</div>
</section>
<!-- Node.js -->
<section id="nodejs" class="example-section">
<h2>Node.js Integration</h2>