Giter Site home page Giter Site logo

ndolestudio / dompdf-api Goto Github PK

View Code? Open in Web Editor NEW
25.0 2.0 5.0 1.17 MB

Laravel API micro-service which to converts HTML to PDF.

License: MIT License

PHP 99.14% Dockerfile 0.86%
html-to-pdf html-to-pdf-api html2pdf-api microservice pdf-generation

dompdf-api's Introduction

dompdf API

Build GitHub contributors GitHub license

This project provides an HTTP API wrapper around the dompdf library which converts HTML to PDF. The API is created using the Laravel framework, and you can protect the API using the basic HTTP authentication scheme.

Docker Setup

Run the docker container using the command below

docker run -p 8000:80 ndolestudio/dompdf-api

Make an HTTP request to convert an HTML string into a PDF file called document.pdf

curl -X POST -d '<h1>Hello World</h1>' http://localhost:8000 --output document.pdf

Authentication

If you want to protect the API with basic auth, you can set the AUTH_USERNAME and AUTH_PASSWORD environment variables when running the docker container

docker run -p 8000:80 \
      --env AUTH_USERNAME="username" \
      --env AUTH_PASSWORD="password" \
      ndolestudio/dompdf-api

NOTE: You must now set the username and password when making requests to the API

## username:password in base64 is dXNlcm5hbWU6cGFzc3dvcmQ=
curl  -X POST -d '<h1>Hello World</h1>' \
      -H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
      http://localhost:8000 --output document.pdf

Security Vulnerabilities

If you discover a security vulnerability within the dompdf-api service, please send an e-mail to Acho Arnold via [email protected]. All security vulnerabilities will be promptly addressed.

License

dompdf-api is an open-sourced software licensed under the MIT license.

dompdf-api's People

Contributors

achoarnold avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dompdf-api's Issues

page numbers

How can I set page numbers in content that is dynamically generated?

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.