Skip to content

formester/pdfester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pdfester

Playwright-based PDF generation service with Gotenberg-compatible API.

Features

  • Gotenberg-compatible API - Drop-in replacement for URL-to-PDF conversion
  • Playwright backend - Fast, reliable Chromium rendering
  • Memory efficient - Browser pooling and automatic cleanup
  • Concurrent processing - Handles multiple requests with configurable limits
  • Docker deployment - Easy setup with included scripts

Quick Start

Local Development

npm install
npm start

Service runs on http://localhost:3000

Production Deployment

  1. Clone repository on your EC2 instance:
git clone https://github.com/formester/pdfester.git
cd pdfester
  1. Make setup script executable and run:
chmod +x setup.sh
sudo ./setup.sh

This will:

  • Install Docker, Docker Compose, Nginx, Certbot
  • Build and start the Pdfester service
  • Configure SSL with Let's Encrypt
  • Set up automatic certificate renewal

API Usage

Convert URL to PDF

curl -X POST \
  -u formester:formesterisprintingpdf \
  -F "url=https://example.com" \
  -F "paperFormat=A4" \
  -F "landscape=false" \
  https://printer.formester.com/forms/chromium/convert/url \
  --output document.pdf

Supported Parameters

  • url (required) - URL to convert to PDF
  • paperFormat - A4, A3, A2, A1, A0, Letter, Legal, Tabloid, Ledger
  • paperWidth / paperHeight - Custom dimensions (e.g., "8.5in", "21cm")
  • landscape - true/false
  • marginTop / marginRight / marginBottom / marginLeft - Margins (e.g., "1in", "2cm")
  • printBackground - true/false (print CSS backgrounds)
  • scale - Scale factor (0.1 - 2)
  • preferCSSPageSize - true/false

Health Check

curl https://printer.formester.com/health

Configuration

Environment variables:

  • PDFESTER_USERNAME - Basic auth username (default: formester)
  • PDFESTER_PASSWORD - Basic auth password (default: formesterisprintingpdf)
  • MAX_CONCURRENT - Maximum concurrent PDF generations (default: 3)
  • TIMEOUT - Request timeout in milliseconds (default: 30000)
  • PORT - Server port (default: 3000)

Management Commands

# View status
docker-compose -f /opt/pdfester/docker-compose.yml ps

# View logs
docker-compose -f /opt/pdfester/docker-compose.yml logs -f

# Restart service
docker-compose -f /opt/pdfester/docker-compose.yml restart

# Update service
cd /opt/pdfester
git pull
docker-compose build --no-cache
docker-compose up -d

Performance

  • Memory usage: ~400-800MB per instance
  • Concurrent requests: 3 by default (configurable)
  • Browser pooling: Reuses browser instances for efficiency
  • Automatic cleanup: Prevents memory leaks

Troubleshooting

  • Check service health: curl http://localhost:3000/health
  • View container logs: docker logs pdfester
  • Test without SSL: curl -u formester:formesterisprintingpdf http://localhost:3000/health

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published