This guide will get you up and running with go-pdf in less than 5 minutes.
- Docker Desktop installed and running
Option A: Using pre-built image (fastest)
docker run -d -p 8080:8080 --name go-pdf ghcr.io/getevo/go-pdf:latestOption B: Build from source
git clone https://github.com/getevo/go-pdf.git
cd go-pdf
docker-compose up -dThis will:
- Start the service on port 8080
- Run in the background
Run the included test script:
./test-api.shOr test manually with curl:
curl -X POST http://localhost:8080/api/v1/generate \
-H "Content-Type: text/html" \
-d '<html><body><h1>Hello PDF!</h1></body></html>' \
-o output.pdfdocker-compose logs -fPress Ctrl+C to stop viewing logs.
docker-compose downEndpoint: POST /api/v1/generate
Request:
- Content-Type: text/html
- Body: Raw HTML content (string)
curl -X POST http://localhost:8080/api/v1/generate \
-H "Content-Type: text/html" \
-d '<html>...</html>' \
-o output.pdfResponse: PDF file (binary)
curl -X POST http://localhost:8080/api/v1/generate \
-H "Content-Type: text/html" \
-d '<!DOCTYPE html><html><head><style>body{font-family:Arial;}</style></head><body><h1>Invoice #001</h1><p>Amount: $100</p></body></html>' \
-o invoice.pdfcurl -X POST http://localhost:8080/api/v1/generate \
-H "Content-Type: text/html" \
-d '<!DOCTYPE html><html><head><style>.header{background:#4CAF50;color:white;padding:20px;}</style></head><body><div class="header"><h1>Monthly Report</h1></div></body></html>' \
-o report.pdfdocker-compose logsEdit docker-compose.yml and change the port:
ports:
- "9090:8080" # Use port 9090 instead- Check that HTML is valid
- Ensure HTML is properly escaped in JSON
- View service logs:
docker logs go-pdf
- Read the full README.md for detailed documentation
- Check the config.yml for configuration options
- Explore the source code in
apps/pdf/
- Check the logs:
docker logs go-pdf - Verify service is running:
docker ps - Test with simple HTML first
- Ensure JSON is properly formatted