All Projects → kool-dev → pdf

kool-dev / pdf

Licence: MIT license
Micro-service for generating PDF files using Puppeteer with an Express API

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to pdf

apify-cli
Apify command-line interface helps you create, develop, build and run Apify actors, and manage the Apify cloud platform.
Stars: ✭ 37 (+131.25%)
Mutual labels:  puppeteer
webparsy
Node.JS library and cli for scraping websites using Puppeteer (or not) and YAML definitions
Stars: ✭ 40 (+150%)
Mutual labels:  puppeteer
puppeteer-loadtest
load test puppeteer (Headless Chrome API) script using node
Stars: ✭ 107 (+568.75%)
Mutual labels:  puppeteer
snap-this
A tool to make quick screenshots for multiple mobile devices of your web app in a couple of minutes.
Stars: ✭ 31 (+93.75%)
Mutual labels:  puppeteer
ZSpider
基于Electron爬虫程序
Stars: ✭ 37 (+131.25%)
Mutual labels:  puppeteer
webgif
Easily generate animated GIFs from websites
Stars: ✭ 98 (+512.5%)
Mutual labels:  puppeteer
mermaid.ink
Given a mermaid code (markdown-like), serve an image for you
Stars: ✭ 43 (+168.75%)
Mutual labels:  puppeteer
Puppetry
基于Puppeteer的页面E2E测试GUI工具
Stars: ✭ 35 (+118.75%)
Mutual labels:  puppeteer
double-agent
A test suite of common scraper detection techniques. See how detectable your scraper stack is.
Stars: ✭ 123 (+668.75%)
Mutual labels:  puppeteer
mugshot
Framework independent visual testing library
Stars: ✭ 126 (+687.5%)
Mutual labels:  puppeteer
codepen-puppeteer
Use Puppeteer to download pens from Codepen.io as single html pages
Stars: ✭ 22 (+37.5%)
Mutual labels:  puppeteer
top.gg-automatic-voter
This is a script that votes for specified bot automatically per 12 hours on top.gg
Stars: ✭ 144 (+800%)
Mutual labels:  puppeteer
abeamer
frame-by-frame Web Animation framework
Stars: ✭ 49 (+206.25%)
Mutual labels:  puppeteer
Viewfinder
📷 BrowserBox - Remote isolated browser API for security, automation visibility and interactivity. Run on our cloud, or bring your own. Full scope double reverse web proxy with multi-tab, mobile-ready browser UI frontend. Plus co-browsing, advanced adaptive streaming, secure document viewing and more! But only in the Pro version. Get BB today! Se…
Stars: ✭ 1,741 (+10781.25%)
Mutual labels:  puppeteer
trafficator
Traffic generator for local analytics testing
Stars: ✭ 27 (+68.75%)
Mutual labels:  puppeteer
puppeteer-serverless
Puppeteer for both serverless functions and development.
Stars: ✭ 28 (+75%)
Mutual labels:  puppeteer
barclayscrape
A small app to programmatically mainpulate Barclays online banking
Stars: ✭ 57 (+256.25%)
Mutual labels:  puppeteer
readme-ascii
Turns text into images of ASCII art for GitHub README files.
Stars: ✭ 48 (+200%)
Mutual labels:  puppeteer
http-server-pwa
👾 http-server alike but for serving and rendering PWA: pwa-server
Stars: ✭ 14 (-12.5%)
Mutual labels:  puppeteer
puppeteer-jest-starter
A starter-kit quipped with the minimal requirements for Puppeteer + Jest, making E2E testing a breeze.
Stars: ✭ 17 (+6.25%)
Mutual labels:  puppeteer

PDF microservice

PDF generation micro-service. Super easy to add on kool and docker-compose based environments, for generating PDFs from any URLs or given HTML content.

Getting started using this microservice in your project

If you use Docker Compose (hopefully with kool to make things simpler) you can get PDF generation on your project with a few simple steps:

  • Add the service to your docker-compose.yml file:
  pdf:
    image: "kooldev/pdf:1.0"
    ports:
      - "3000:3000"
  • After starting the service containers (with either kool start or docker-compose up -d), you can already start using the microservice to make PDFs! Example using PHP:
use GuzzleHttp\Client;

// the hostname is the docker-compose service name, or an alias you add to your docker network
$pdf = (new Client())->post('http://pdf:3000/from-html', [
    'form_params' => [
        'html' => '<h1>This is my super kool HTML that I want to turn into an awesome PDF file!</h1> <p> This is a very silly example, but you get the idea of how powerful this is <b>:)</b> </p>',
        'options' => json_encode([
            'format' => 'A4',
            'printBackground' => false,
        ]),
    ],
])->getBody();

file_put_contents('path/to/my/super-kool.pdf', $pdf);
  • Important to notice, the code above assumes you are running it from within another container in the same Docker Compose application so the pdf domain resolves to our microservice.

  • The options should be a json data type

  • You can see all these options in puppeteer docs

Getting started on developing locally this microservice

To get started with development locally (using kool, of course!):

  • Fork the repo.
  • Clone the fork.
  • kool run yarn install - this will install dependencies.
  • kool start - will get up the API on localhost:3000.
  • docker-compose logs -f - tails the API logs.

In order to manage dependencies and run commands, please remind of using kool run yarn to stick with one single yarn version.

Roadmap

Soon to be added wishes:

  • Parameters to better control Javascript execution/wait condition.
  • Conversion to images also.
  • Got some kool feature you are not seeing? Please open a ticket to suggest it!

API

The API will provide endpoints for generating PDFs on the fly and returning them right away.

From an URL

Endpoint: GET /from-url?url=

Parameters:

  • url: URL of the page we want to convert to PDF.

Returns the rendered PDF from the provided URL, or a JSON with an error message and status.

Health status

Endpoint: GET /health

Returns the current status in JSON. Status code may be 200 (active) or 503 (not ready).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].