Git Product home page Git Product logo

wkhtmltopdf-microservice's Introduction

wkhtmltopdf-microservice

Blazing fast Docker microservice for wkhtmltopdf and wkhtmltoimage

GitHub Stars Docker Pulls Docker Stars Issues MIT licensed

Docker image

https://hub.docker.com/r/umex/wkhtmltopdf-microservice

# Check the latest image version tag at Docker Hub
image: umex/wkhtmltopdf-microservice:1.2-alpine

Docker service

Quick test

docker run -p 9100:9100 --name wkhtmltopdf umex/wkhtmltopdf-microservice:1.2-alpine 

If you just use it internally within your Docker network, it is not required (and not recommendable) to expose the port.

For example: Your service any_backend can make HTTP requests to http://wkhtmltopdf:9100/pdf.

services:
   any_backend:
      image: superman/any_backend:latest
      ports:
         - "80:80"
      
   wkhtmltopdf:
      container_name: wkhtmltopdf_service
      image: umex/wkhtmltopdf-microservice:1.2-alpine
      restart: unless-stopped

Environment

wkhtmltopdf:
   environment:
      # Default max body size
      MAX_BODY: '50mb'
      # Max requests per minute
      MAX_REQUESTS: 100
      NODE_PORT: 9100

Check service is running

To test if the service is available, you can simply send a GET request to the service and should see a landing page. If you do this from your local browser, you need to expose the service port first.

GET http://localhost:9100
GET http://wkhtmltopdf:9100

Create PDF

POST http://localhost:9100/pdf
POST http://wkhtmltopdf:9100/pdf

PDF options: https://www.mankier.com/1/wkhtmltopdf

# JSON POST body
   
{
    "html": "<html><body><h1 style=\"color: red;\">HI I AM HERE</h1></body></html>",
    "wkConfig": {
        "dpi": "1200",
        "grayscale": true,
        "disableSmartShrinking": true,
        "imageQuality": 100,
        "pageWidth": 400,
        "pageHeight": 280,
        "marginTop": 0,
        "marginBottom": 0,
        "marginLeft": 0,
        "marginRight": 0
    }
}

Create IMAGE

POST http://localhost:9100/img
POST http://wkhtmltopdf:9100/img

Image options: https://www.mankier.com/1/wkhtmltoimage

# JSON POST body
   
{
   "html": "<html><body><h1 style=\"color: red;\">HI I AM HERE</h1></body></html>",
   "wkConfig": {
      "width": 400,
      "height": 280,
      "quality": 100
   }
}

Open source

Credits

wkhtmltopdf-microservice's People

Contributors

btxtiger avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.