8000 GitHub - filedcom/pdf2images
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

filedcom/pdf2images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdf2images: PDF to WebP conversion service

A high-performance REST API service built with Deno that converts PDF documents to WebP images. The service processes PDFs, optimizes the images with Sharp, and returns a ZIP archive containing WebP images for each page.

Features

  • 🚀 Fast PDF to WebP conversion
  • 📦 Returns all pages as a ZIP archive
  • 🛡️ Built with Deno for enhanced security

Prerequisites

  • Deno 2.x or higher

Installation

  1. Clone the repository
  2. Install Deno if you haven't already: https://deno.land/manual/getting_started/installation
deno install --allow-scripts

Usage

Starting the Server

deno task start

The server will start on port 8787 by default. You can customize the port by setting the PORT environment variable.

API Endpoints

Health Check

  • GET /
  • Returns "ok" if the server is running

Convert PDF to WebP Images

  • POST /pdf-to-images
  • Content-Type: multipart/form-data
  • Request body:
    • pdf: PDF file to convert

Response:

  • 200: ZIP archive containing WebP images for each page
  • 400: Error if no PDF file is uploaded
  • 500: Server error with error message

Example Usage

Using cURL:

curl -X POST -F "pdf=@/path/to/your/document.pdf" http://localhost:8787/pdf-to-images -o pages.zip

Load Testing

The project includes K6 load testing configuration. To run the load tests:

  1. Set the PDF_PATH environment variable to your test PDF file
  2. Run the test:
k6 run --env PDF_PATH=/path/to/your/test.pdf ./k6.js

Docker

Build

docker build . -t pdf2images:latest

Run

docker run -p 8787:8787 --rm pdf2images:latest

Deploy to azure container apps

You should have az cli installed with a resource group and container registry initialized

  1. Login to your ACR registry
 az acr login --name <your-registry-name>
  1. Build and push the Docker image to ACR:
docker build --platform linux/amd64 -t <your-registry-name>.azurecr.io/pdf2images:latest .
docker push <your-registry-name>.azurecr.io/pdf2images:latest
  1. Deploy the container app using the UI

Your API will now be accessible at the URL shown in the deployment output.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0