Giter Site home page Giter Site logo

aidox-pdf-gen's Introduction

PDF Generator Flask microservice

Travis Docker Pulls License

This is a microservice which handles pdfkit (which uses wkhtmltopdf) to make PDF generation from HTML a piece of cake.

Docker hub installation

docker run -d --name wkhtmltopdf-aas -p <hostport>:80 ciricihq/wkhtmltopdf-aas

Builds are automatically generated from github.

Manual installation

pip install -r requeriments.txt

Starting server

python app.py

Build Docker container

docker build -t ciricihq/wkhtmltopdf-aas .

Starting Docker container

docker run -d --name wkhtmltopdf-aas -p <hostport>:80 ciricihq/wkhtmltopdf-aas

Testing the microservice

Testing providing url to render:

curl -F "url=http://cirici.com" 'http://localhost:5000/pdf' > youramazingfile.pdf

Testing uploading contents:

curl -F "[email protected]" 'http://localhost:5000/pdf' > youramazingfile.pdf

Testing passing html as string:

curl -F "html=<html><head> <meta charset%3D\"utf8\"> </head><body>Hello world</body></html>" 'http://localhost:5000/pdf' > youramazingfile.pdf

Passing options

You can use all the wkhtmltopdf options passing in a options array as following example (if option should not receive value just send the option without value):

curl -F "url=http://cirici.com" -F "options[orientation]=Landscape" -F "options[grayscale]" 'http://localhost:5000/pdf' > youramazingfile.pdf

You want to generate images? No problem, just change the pdf endpoint to jpg.

aidox-pdf-gen's People

Contributors

elboletaire avatar ddeisadze avatar weijia 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.