Code Monkey home page Code Monkey logo

pdfman's Introduction

PDFMAN

PDFMAN is a Puppeteer-based and wrapper providing a web API as an alternative to wkhtmltopdf. It exposes a web API for generating a PDF file from an HTML document. PDFMAN is built on top of the Puppeteer Report and is available as a Docker image on Docker Hub.

How to Use

1. Using Docker Run

  1. Make sure you have Docker installed on your machine.
  2. Run the following command to start PDFMAN using Docker:
    docker run --rm -p 3000:3000 -v /path/to/css/file/style.css:/app/tmp gorvelyfab/pdfman
  3. Access the PDFMAN API at http://localhost:3000 to generate PDFs from HTML documents.

2. Using Docker Compose

services:
  pdfman:
    image: gorvelyfab/pdfman
    ports:
      - 3000:3000
    volumes:
      ./style.css:/app/tmp/style.css
    environment:
      PORT: 3000

Generate your first pdf document by making a post request at http://localhost:3000/pdf. Make sur to Setup the request header Content-Type as multipart/form-data and the html file field name must be html

curl --request POST \
  --url http://localhost:3000/pdf \
  --header 'Content-Type: multipart/form-data \
  --form html=@/home/gorvely/Downloads/demo/test.html

Codes samples

/* style.css */
body {
    color: red;
}
<!-- file.html -->
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document Example</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h1>Hello world</h1>

    <p>This paragraph showing text colored in RED.</p>
</body>
</html>

Author

Gorvely Tasinda [email protected]

Contribution

Feel free to contribute to PDFMAN by submitting issues or pull requests. For major changes, please open an issue first to discuss potential modifications.

License

This project is licensed under the MIT License - see the LICENSE file for details.

pdfman's People

Contributors

gorvelyfab 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.