Skip to content

A simple Go application for merging multiple PDF files into one and generate pdf from HTML with support for uploading to S3

License

Notifications You must be signed in to change notification settings

jojomak13/pdf-toolbox

Repository files navigation

PDF Toolbox

Go Report Card Latest Release License Docker Pulls Docker Image Size Docker Stars

A simple Go application for merging multiple PDF files into one and generate pdf from html with support for uploading to S3.

Installation

Download the latest release from here.

Usage

Endpoint: POST /merge

Request Body

{
    "file_path": "invoices/02-2025-20-18_0_invoices.pdf",
    "urls": [
        "https://pdfobject.com/pdf/sample.pdf",
        "https://my-storage.amazonaws.com/16-02-2025-20-18_0_sample.pdf"
    ]
}

Response (Success)

{
    "data": {
        "url": "https://my-storage.amazonaws.com/invoices/02-2025-20-18_0_invoices.pdf"
    },
    "message": "success",
    "status": true
}

Endpoint: POST /html

This endpoint accepts raw HTML content and converts it into a PDF file.

Headers

  • FILE-PATH: The path where the generated PDF will be saved.

Request Body

<html>
<head>
    <title>Sample PDF</title>
</head>
<body>
    <h1>Hello, PDF!</h1>
</body>
</html>

Response (Success)

{
    "data": {
        "url": "https://my-storage.amazonaws.com/generated/sample.pdf"
    },
    "message": "success",
    "status": true
}

🐳 Docker Deployment

Quick Start

docker-compose up -d

Prerequisites

  • Docker and Docker Compose installed on your system
  • AWS S3 credentials (for storage functionality)

Configuration

Create a .env file in your project root with the following variables:

# AWS S3 Configuration (Required)
S3_KEY=your-aws-access-key
S3_SECRET=your-aws-secret-key
S3_REGION=your-aws-region
S3_BUCKET=your-bucket-name

Environment Variables

Variable Required Default Description
APP_NAME No PDF-Toolbox Application name
PORT No 8080 Port the application listens on
S3_KEY Yes - AWS Access Key ID
S3_SECRET Yes - AWS Secret Access Key
S3_REGION Yes - AWS Region
S3_BUCKET Yes - S3 Bucket name
OUTPUT_FILE_NAME No out.pdf Default output filename

License

This project is licensed under the MIT License.

About

A simple Go application for merging multiple PDF files into one and generate pdf from HTML with support for uploading to S3

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •