Skip to content

chinmay-sawant/gopdfsuit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

603 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ GoPdfSuit

Go Version Gin Framework Docker gochromedp License Ask DeepWiki

πŸš€ A powerful Go web service for template-based PDF generation with multi-page support, PDF merging, form filling, and HTML to PDF/Image conversion.

Star History

Star History Chart

⚑ Performance & Efficiency

92% Cost Reduction vs traditional distributed architectures.

Metric Industry Standard (Typst/LaTeX) gopdfsuit (Go 1.24)
Infrastructure ~40 Node Cluster 2 Nodes (95% Less)
Cost (1.5M PDFs) ~$10.20 / day ~$0.77 / day
Throughput ~1k PDFs/sec (Cluster) ~600 PDFs/sec (Single Node)

Result: Generates 1.5 million financial PDFs in ~45 mins on a single machine.


πŸ“‘ Table of Contents

πŸ“š Documentation


πŸ“– Overview

GoPdfSuit is a powerful Go web service for template-based PDF generation.

Key Features:

  • Template-Based Generation: Create PDFs from JSON templates with auto page breaks and flow control.
  • Security & Compliance: Digital signatures (PKCS#7, X.509), AES-256 encryption, granular permissions, and PDF/A-4 & PDF/UA-2 compliance.
  • Advanced Elements: Rich text styling, tables, barcodes, QR codes, SVG vector graphics, and interactive forms (checkboxes, radio buttons).
  • Navigation: Auto-generated bookmarks, internal links, and named destinations for easy document navigation.
  • Form Filling: Fill generic AcroForms and XFDF data.
  • Redaction: Securely redact sensitive information using specific coordinates or text search.
  • Merge & Split: Combine multiple PDFs or split them.
  • HTML Conversion: High-fidelity HTML to PDF/Image conversion using headless Chrome.
  • Native Bindings:
    • Python: Direct CGO bindings for high-performance integration.
    • Go: Usable as a standalone Go library (gopdflib).
  • Web Interfaces: Built-in React UI for viewer, editor, merger, filler, and converters.

Requirements: Go 1.24+, Google Chrome (for HTML conversion)


❓ FAQ

Chrome not found error?

Install Google Chrome - required for HTML to PDF/Image conversion:

sudo apt install -y google-chrome-stable
How do auto page breaks work?

The system tracks Y position and creates new pages when content exceeds boundaries. Page borders and numbering are preserved across pages.

How do I create a digitally signed PDF?

Include the signature config with your PEM-encoded certificate and private key:

{
  "config": {
    "signature": {
      "enabled": true,
      "visible": true,
      "certificatePem": "-----BEGIN CERTIFICATE-----\n...",
      "privateKeyPem": "-----BEGIN PRIVATE KEY-----\n..."
    }
  }
}

Supports RSA and ECDSA keys with optional certificate chains.

What is PDF/A-4 compliance?

PDF/A-4 is the archival standard based on PDF 2.0. Enable it with "pdfaCompliant": true. This embeds all fonts (via Liberation fonts), adds XMP metadata, and follows strict structure requirements for long-term preservation.

How do internal links work?
  1. Add a destination anchor to a cell: "dest": "my-section"
  2. Link to it from another cell: "link": "#my-section"
  3. Optionally add a bookmark: {"title": "My Section", "dest": "my-section"}
XFDF form filling limitations?

Uses byte-oriented approach with /NeedAppearances true. Works for most AcroForms, but PDFs with compressed object streams may need a library like pdfcpu for full compatibility.

Performance benchmarks?

Sub-millisecond to ~7ms response times for complex 2-page financial reports. In-memory processing with zero external dependencies.


πŸ› οΈ Development

# Build
go build -o bin/gopdfsuit ./cmd/gopdfsuit

# Cross-compile
GOOS=linux GOARCH=amd64 go build -o bin/gopdfsuit-linux ./cmd/gopdfsuit

# Test
go test -cover ./...

Project Structure

gopdfsuit/
β”œβ”€β”€ bindings/           # Native language bindings (Python CGO)
β”œβ”€β”€ cmd/gopdfsuit/      # Application entrypoint
β”œβ”€β”€ docs/               # Built frontend assets
β”œβ”€β”€ frontend/           # React frontend (Vite)
β”œβ”€β”€ guides/             # Documentation guides
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ handlers/       # HTTP handlers
β”‚   β”œβ”€β”€ middleware/     # Gin middleware
β”‚   β”œβ”€β”€ models/         # Template models
β”‚   └── pdf/            # PDF generation & processing
β”œβ”€β”€ pkg/
β”‚   └── gopdflib/       # Standalone Go library
β”œβ”€β”€ sampledata/         # Sample templates & data
└── test/               # Integration tests

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add feature')
  4. Push (git push origin feature/amazing)
  5. Open a Pull Request

πŸ“„ License

MIT License - see LICENSE


Made with ❀️ by Chinmay Sawant

⭐ Star this repo if you find it helpful!

Developed from scratch with assistance from GitHub Copilot.