
What is Gotenberg?
Gotenberg is a powerful, open-source web API dedicated to converting various document formats into PDFs. Written in Go and currently at version 8, it excels at swiftly transforming HTML, URLs, and Markdown files into professional PDFs. Ideal for developers seeking scalable document conversion solutions, Gotenberg's Docker-based deployment simplifies the setup and maintenance processes, making it perfect for SaaS platforms.
You can check out their well-written and complete documentation here.
Setting Up Your Gotenberg Instance
Since Gotenberg is fully containerized, you have multiple deployment methods at your disposal—from local Docker setups to managed Kubernetes clusters and cloud-based serverless solutions. If you're unfamiliar with deploying containerized applications, this guide will walk you through each approach clearly and step by step.
Deploying Gotenberg using Docker Compose
Deploying Gotenberg with Docker Compose is straightforward. Ensure Docker is installed and running:
Run docker-compose up -d to initiate your instance rapidly.
Deploying Gotenberg using Kubernetes
For resilience and scalability, Kubernetes deployment is ideal. Use this deployment YAML:
Deploy with kubectl apply -f gotenberg.yaml.
Deploying Gotenberg using Google Cloud Run
For cost-effective serverless deployment, Google Cloud Run is a compelling choice. Utilize the specialized Docker image:
- gotenberg/gotenberg:8-cloudrun
- Alternatively, use the historical Docker image: thecodingmachine/gotenberg:8-cloudrun
Use the Google Cloud CLI:
Deploying Gotenberg using AWS Lambda (Recommended for Serverless Workloads)
Gotenberg provides an official Lambda-optimized container image, making AWS Lambda a lightweight and cost-efficient option for PDF generation. This approach is ideal if you want automatic scaling, pay-per-use pricing, and minimal infrastructure management.
Use the dedicated image:
Steps to deploy:
Push the image to Amazon ECR
Create an ECR repository, then build and push the image (optionally via a simple Dockerfile that pins Gotenberg’s version).
Create a Lambda function from the container image
Minimum recommended memory: 1024 MB (more memory = better Chromium/LibreOffice performance).
Timeout: 30–60 seconds, depending on document complexity.
Expose the Lambda via Function URL or API Gateway
For internal traffic, use a Lambda Function URL with AWS_IAM authentication.
For public or partner-facing tools, place API Gateway in front of Lambda to gain features like rate limiting, IP throttling, API keys, and custom domains.
Call Gotenberg via HTTP
The official Lambda image runs the AWS Lambda Web Adapter, so you interact with Gotenberg exactly as you would in a normal container—using standard endpoints such as:
Notes
Large PDF responses may exceed Lambda’s synchronous payload limits. For heavy workloads, Gotenberg supports webhooks, allowing the Lambda to deliver output directly to S3 or another endpoint.
If you prefer infrastructure-level scaling or long-running workloads, AWS ECS or Fargate remain excellent alternatives.
Generating PDF with Gotenberg
Generating PDF using an URL
Generate PDFs directly from URLs via simple HTTP requests:
Generating PDF from HTML
Convert HTML files into PDFs seamlessly:
Generating PDF from Markdown
Quickly convert Markdown files:
Advanced PDF Configurations
Print options
Customize your PDF output extensively:
singlePage: falsepaperWidth: 8.5paperHeight: 11marginTop: 0.39marginBottom: 0.39marginLeft: 0.39marginRight: 0.39preferCssPageSize: falsegenerateDocumentOutline: falseprintBackground: falseomitBackground: falselandscape: falsescale: 1.0nativePageRanges: All pages
Example request:
Generating PDF Header and Footer
Customize headers and footers with HTML strings, leveraging classes like pageNumber, totalPages, title, and date:
Other PDF Functions
Gotenberg leverages LibreOffice to handle diverse PDF tasks, including merging, splitting, compression, and converting to archival PDF/A formats.
Merge example:
Alternative: Generate PDFs with pdf noodle

Managing HTML-to-PDF conversion at scale can quickly become a nightmare!
Especially in serverless environments where cold starts, memory limits, and headless browser quirks love to break at the worst possible time (we even wrote a full article about it). Add constant template iterations, version control headaches, and the need to support non-technical contributors, and suddenly your “simple PDF library” turns into an ongoing engineering project.
pdf noodle eliminates all of that.
Instead of maintaining brittle infrastructure or wrestling with outdated pdf libraries, pdf noodle gives you a battle-tested PDF generation API that just works!
Fast, scalable, and designed for both developers and non-developers. You send raw HTML or use our AI-powered template builder, and pdf noodle handles the rendering, scaling, optimization, and delivery so your team doesn’t have to.
Here's an example of a simple API request to generate your pixel-perfect PDF with just a few lines of code:
pdf noodle also includes a powerful AI Agent that can generate PDF templates instantly, along with a modern editor for refining the design, also using AI, to match your brand. You don't need developing or design experience to quickly update layouts, adjust styling, and manage template versions.
Here’s a quick demo showing how it works:
You can create your account and design your first template without any upfront payment.
Conclusion
Gotenberg offers an efficient, containerized approach to generating PDFs at scale, making it highly suitable for applications with predictable, consistent document formats. Its versatility in deployment and ease of integration into existing infrastructures make it a robust choice for SaaS developers.
If you don't want to waste time maintaining pdfs layouts and their infrastructure or if you don't want to keep track of best practices to generate PDFs at scale, third-party PDF APIs like pdf noodle will save you hours of work and deliver a high quality pdf layout.


