Giter VIP home page Giter VIP logo

pdfactory's Introduction

Overview

CleanShot 2023-01-18 at 09 22 23@2x

Features

  • Create PDFs from HTML templates
  • Create Images from HTML
  • Variables for dynamic content
  • API for integration into other systems
  • Custom css per template
  • Add new fonts
  • Support Jinja2

Getting Started

Installation

docker run -d -p 8000:8000 \
-e "DB_NAME=pdfactory" \
-e "DB_PORT=5432" \
-e "DB_USER=postgres" \
-e "DB_PASS=password" \
-e "DB_HOST=localhost" \
-e "[email protected]" \
-e "ADMIN_PASSWORD=admin" \
-e "DOMAIN=https://pdfactory.com" \
--name pdfactory wildsonc/pdfactory

User: [email protected] Password: admin

HTML to PDF

curl --location --request POST 'http://localhost:8000/api/pdf' \
--header 'Authorization: Bearer 44f976aafa9277af948f54ad43c37cc813e6facd' \
--header 'Content-Type: application/json' \
--data-raw '{
    "template_id": "2",
    "json": {
        "client": "John Due",
        "provider": "Company",
        "amount": "$ 1000,00",
        "period": "12 months"
    }
}'

Optional parameters

When any of these parameters are sent, the response will be in json.

  • output_html: boolean
  • output_base64: boolean
  • upload: boolean

To use the upload it is necessary to configure the storage

HTML to Image

curl --location --request POST 'http://localhost:8000/api/image' \
--header 'Authorization: Bearer 44f976aafa9277af948f54ad43c37cc813e6facd' \
--header 'Content-Type: application/json' \
--data-raw '{
    "html": "<html>...</html>",
    "upload": true # optional
}'

Optional parameters

When any of these parameters are sent, the response will be in json.

  • upload: boolean

    To use the upload it is necessary to configure the storage

Storage (Optional)

Additional environments

S3_ENDPOINT=
S3_ACCESS_KEY=
S3_SECRET_KEY=
S3_BUCKET=

Usage

curl --location --request POST 'http://localhost:8000/api/pdf' \
--header 'Authorization: Bearer 44f976aafa9277af948f54ad43c37cc813e6facd' \
--header 'Content-Type: application/json' \
--data-raw '{
    "template_id": "2",
    "upload": true,
    "json": {
        "client": "John Due",
        "provider": "Company",
        "amount": "$ 1000,00",
        "period": "12 months"
    }
}'

pdfactory's People

Contributors

wildsonc avatar

Stargazers

 avatar

Watchers

 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.