Generate PDFs from AI chats with a link
An AI assistant can give its user a real PDF file with one link. Put the document in the link as Markdown or HTML; when the user opens it, ToolkitMate builds the PDF in their browser and downloads it. No API key, no server, nothing uploaded.
The generate_pdf link
https://toolkitmate.com/tools/markdown-to-pdf#md=<URL-encoded Markdown>&name=<file name>&auto=1
https://toolkitmate.com/tools/html-to-pdf#html=<URL-encoded HTML>&name=<file name>&auto=1| Parameter | Meaning |
|---|---|
md / text | The document as Markdown (tables, lists, code, images by URL). URL-encode it. |
html | The document as HTML with optional <style>. Scripts are removed. |
mdz / htmlz | Same, compressed for long documents: deflate-raw, then base64url (see below). |
name | Output file name, e.g. report.pdf. |
auto=1 | Start the download as soon as the page opens. Without it the user sees a preview and presses Download. |
Everything goes after #. Browsers never send that part of a URL to a server, so the document stays between the assistant's reply and the user's browser.
Examples
Weekly report (Markdown → PDF, downloads automatically)
Invoice (HTML → PDF, preview first)
Long documents
Keep plain links under about 8,000 characters. For longer content, compress it and use mdz:
const bytes = new TextEncoder().encode(markdown);
const z = new Uint8Array(await new Response(new Blob([bytes]).stream()
.pipeThrough(new CompressionStream('deflate-raw'))).arrayBuffer());
const b64url = btoa(String.fromCharCode(...z)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
const link = 'https://toolkitmate.com/tools/markdown-to-pdf#mdz=' + b64url + '&name=report.pdf';In Python: base64.urlsafe_b64encode(zlib.compress(text.encode(), 9)[2:-4]).rstrip(b'=') (strip the zlib header and checksum to get raw deflate).
Build a link
FAQ
Can ChatGPT or Claude give me a PDF file?
Yes. The assistant writes the content as Markdown or HTML and gives you a ToolkitMate link; opening it builds the PDF in your own browser and downloads it. Nothing is uploaded.
Is the content sent to your server?
No. The content is in the part of the link after #, which browsers never send to any server. The PDF is made on your device.
How long can the document be?
Plain links work well up to about 8,000 characters. For longer documents use the compressed form (mdz= or htmlz=); the page accepts up to 2 million characters.
Does it cost anything or need an account?
No. It is free, needs no sign-up and has no API key.
Other tools
All ToolkitMate tools run in the browser. A list for language models is at /llms.txt; useful companions: Markdown previewer, Merge PDF, PDF compressor, Word to PDF.