Code Monkey home page Code Monkey logo

papyrus's Introduction

Papyrus

Reading furnishes the mind only with materials of knowledge; it is thinking that makes what we read ours.

-- John Locke

Papyrus is an application to save a pdf version of any webpage.

Usage

1. Install dependencies

Run npm install

2. Start the server

Run node index.js

API

Papyrus exposes some POST endpoints for pdf generation:

  1. /pdf: The webpage to be printed is provided as the request body param webURL.

Sample request:

curl --location --request POST 'localhost:3000/pdf' --header 'Content-Type: application/json' --data-raw '{
    "webURL": "https://en.wikipedia.org/wiki/Papyrus"
}' > download.pdf

The pdf is written to the file download.pdf.

  1. /html2pdf: The webpage to be printed is provided as an HTML file with any key.

Sample request:

curl --location --request POST 'localhost:3000/html2pdf' \
--form 'file=@"/path/to/file/Or/Use/sample.html/from/this/repo"' > download.pdf

Disclaimer

The project could use a lot of improvements, some of which are mentioned in the issues. Feel free to add feature requests if you want some functionality to be added or contribute to the project by raising a PR.

papyrus's People

Contributors

charchit26 avatar meghajit avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

charchit26

papyrus's Issues

Use stream for generating the pdf

Currently generating the pdf creates a local file. This is overwritten for each request, and hence can cause concurrency problems as well as increase disk space if the file is huge.
One approach could be to use streams

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.