Add a 'Download PDF' button to any website with a GET

Learn how to add a PDF download button to your website with a simple GET request. No API key, no heavy dependencies. Ideal for invoices, reports, and more.

15 jul 2026 • 5 min read • Q2BSTUDIO Team

Convert any web page to PDF with a single GET call

In the development of modern web applications, one of the most requested features by users is the ability to download content in PDF format. Whether it's for invoices, reports, certificates, or any dynamically generated document, the user experience is greatly improved when a direct download button is offered. However, implementing this feature can become a technical headache: heavy libraries like Puppeteer add hundreds of megabytes to the deployment, tools like wkhtmltopdf are abandoned, and client-side solutions often fail with complex CSS. The paradox is that you already have the website perfectly designed; all you need is to convert it to PDF without complications. In this article, we'll explore a minimalist approach that eliminates friction: a simple GET request to a specialized service that, acting as a lightweight proxy, returns the bytes of the PDF ready for download.

The key is to separate the rendering responsibility from the rest of the application. Instead of embedding a rendering engine on your server, you delegate that task to an external endpoint that receives a URL, launches a browser without a graphical interface, and returns the result in PDF format. This pattern is particularly useful when you already have a web interface that displays the information as you want it to appear in the PDF. You don't need to learn a rectangle drawing API or maintain a complex dependency; you simply ask the service to capture the page as is. The response is binary, with the content type application/pdf, so you can write it directly to the file system or send it to the user's browser without intermediate transformations.

Implementing this functionality in your backend is surprisingly simple. With Node.js 18+, which includes fetch natively, you can create a proxy in Express that receives the document ID, constructs the preview URL (for example, /invoices/123/print), and makes the request to the rendering service. It's a good idea to use a parameter like wait_for_selector to make sure that dynamic content (such as invoice lines loaded using JavaScript) is already visible before you capture the image. Once you get the response, you set the Content-Type and Content-Disposition headers to the attachment value to force the download, and send the buffer to the client. The frontend only needs one common link: Download PDF. This is all; you don't require SDKs or complicated API keys.

Not only is this approach clean, but it also makes it easier to adopt good security practices. Since the rendering service visits the URL as an anonymous browser, your invoice page should not be protected solely by session cookies. The standard solution is to expose a print path with an ephemeral token: /invoices/123/print?token=abc123. The backend generates that digitally signed token, associates it with the authenticated user, and invalidates it after use. This way, even if someone intercepts the link, they will only have temporary access to that specific document. Cybersecurity is naturally integrated into the flow, and you can complement it with additional measures such as limiting the lifetime of the token or recording each download.

In terms of performance, it should be noted that each request involves launching a real browser, which can consume between one and three seconds. For an on-demand request (a user clicking a button), that latency is perfectly acceptable. However, if your application needs to generate hundreds or thousands of PDFs in bulk (e.g., monthly client statements), it's a good idea to implement an asynchronous processing queue and cache the results. You can store the generated PDF in an Amazon S3 or Azure Blob Storage bucket, and serve the download from there, reducing the load on the rendering service. This is where AWS and Azure cloud services shine: they allow you to scale out both the proxy and the workers who queue tasks, all without manual server management.

The practical applications of this pattern go far beyond invoices. It works for receipts, delivery notes, academic certificates, sales reports, shipping labels and any document that you can layout with HTML and CSS. In fact, HTML+CSS is still the best design engine for documents, much more flexible than traditional PDF libraries. If you also integrate artificial intelligence for companies, you can dynamically generate the content of the page before capturing it; for example, an AI agent that writes a custom report in natural language and then converts it to PDF with the same proxy. AI agents can orchestrate the entire flow: from querying databases to file delivery to conversion.

At Q2BSTUDIO, we understand that every business has unique needs. That's why we offer bespoke application development that incorporates these modern architectures with a pragmatic approach. If your organization already uses Power BI for business intelligence, we can connect reports with a PDF proxy, so a user can download an interactive report as a static document, while maintaining visual fidelity. We also help implement cybersecurity solutions, such as temporary token generation and download auditing, all within a regulatory compliance framework. Our AWS and Azure cloud services allow you to deploy these proxies with serverless functions (Lambda, Cloud Functions) that only run on demand, optimizing costs. And when business logic requires more than just a proxy, we build complete systems with messaging queues, distributed caches, and monitoring, always with the philosophy of keeping it simple wherever possible.

In short, adding a PDF download button to your app shouldn't be a complex project. By separating the responsibility of rendering into an external service and using a lightweight proxy on your backend, you get an elegant, scalable, and secure solution. This same pattern is adapted to artificial intelligence contexts, where AI agents automate document generation, or to business intelligence environments where Power BI needs to export reports. At Q2BSTUDIO we apply these best practices in every custom software project, ensuring that the end result is as functional as it is intuitive for the user. The next time you're asked for a PDF download button, remember that sometimes the most powerful solution is also the simplest.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.