Skip to content

borisevstratov/pdf-cut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdf-cut

A tiny, fast, and straightforward REST API for working with PDF files. No complex SDKs. Just pure HTTP.

License: MIT GitHub Actions Workflow Status


Usage

Run the container with Docker

docker run -p 8080:8080 ghcr.io/borisevstratov/pdf-cut:latest

The API will be available at: http://localhost:8080

Run with Docker Compose

services:
  pdf-cut:
    image: ghcr.io/borisevstratov/pdf-cut:latest
    container_name: pdf-cut
    ports:
      - "8080:8080"

Start with:

docker compose up -d

API

Health

GET /health — Health check.


Compress PDF

POST /compress — Reduces the size of a PDF file.

Payload:

  • file (multipart/form-data, optional): PDF file
  • url (form-data, optional): Public link to a remote PDF

Response: compressed PDF file


Extract Pages

POST /extract — Extracts a range of pages from a PDF.

Payload:

  • file (multipart/form-data, optional): PDF file
  • url (form-data, optional): Public link to a remote PDF
  • pageStart (integer, required): first page to include
  • pageEnd (integer, required): last page to include

Response: a new PDF containing only the selected pages


Merge PDFs

POST /merge — Combines multiple PDFs into a single document.

Payload:

  • files (multipart/form-data, optional): Multiple PDF files

  • urls (form-data, optional): JSON array of public links to PDFs

    ["https://example.com/a.pdf", "https://example.com/b.pdf"]

Local development

Running locally:

go run main.go
go build -o pdf-cut .

Build with Docker:

docker build -t pdf-cut .
docker run -p 8080:8080 pdf-cut

About

REST API for basic PDF manipulations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors