All Projects → msokk → Electron Render Service

msokk / Electron Render Service

Licence: mit
Microservice for rendering PDF/PNG/JPEG from HTML with Electron

Projects that are alternatives of or similar to Electron Render Service

Html Pdf Service
LGPL V3. Java Spring Boot microservice with RESTful webconsole and service endpoints that convert HTML to PDF, optionally styling with CSS and templating with JSON using Flying Saucer, PDF Box and Jackson libraries. Available on Docker Hub.
Stars: ✭ 12 (-88.46%)
Mutual labels:  microservice, pdf
Pdf
Simple http microservice that converts Word documents to PDF
Stars: ✭ 107 (+2.88%)
Mutual labels:  microservice, pdf
Go Shopping
A sample suite of services built on the go-micro framework
Stars: ✭ 98 (-5.77%)
Mutual labels:  microservice
Orion
Orion is a small lightweight framework written around grpc/protobuf with the aim to shorten time to build microservices at Carousell.
Stars: ✭ 101 (-2.88%)
Mutual labels:  microservice
Phalapi
A PHP framework foucs on API fast development.接口,从简单开始!PhalApi简称π框架,一个轻量级PHP开源接口框架,专注于接口服务开发。
Stars: ✭ 1,365 (+1212.5%)
Mutual labels:  microservice
Mustangproject
Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)
Stars: ✭ 98 (-5.77%)
Mutual labels:  pdf
Quad
document processor in Racket
Stars: ✭ 100 (-3.85%)
Mutual labels:  pdf
Universal Resume
Minimal and formal résumé (CV) website template for print, mobile, and desktop. https://bit.ly/ur_demo
Stars: ✭ 1,349 (+1197.12%)
Mutual labels:  pdf
I7j Pdfhtml
pdfHTML is an iText 7 add-on for Java that allows you to easily convert HTML and CSS into standards compliant PDFs that are accessible, searchable and usable for indexing.
Stars: ✭ 104 (+0%)
Mutual labels:  pdf
Htmldoc
HTML Conversion Software
Stars: ✭ 99 (-4.81%)
Mutual labels:  pdf
Kitsvc
⚙ 一個基於 Golang、Consul、Prometheus、EventStore、Gin、Gorm、NSQ 的微服務起始結構。
Stars: ✭ 101 (-2.88%)
Mutual labels:  microservice
Barong
Barong auth server
Stars: ✭ 100 (-3.85%)
Mutual labels:  microservice
Tabula Py
Simple wrapper of tabula-java: extract table from PDF into pandas DataFrame
Stars: ✭ 1,351 (+1199.04%)
Mutual labels:  pdf
Jupiter
Jupiter是一款性能非常不错的, 轻量级的分布式服务框架
Stars: ✭ 1,372 (+1219.23%)
Mutual labels:  microservice
Pdf Generator
Cordova plugin to generate pdf in the client-side
Stars: ✭ 98 (-5.77%)
Mutual labels:  pdf
Staffjoy
微服务(Microservices)和云原生架构教学案例项目,基于Spring Boot和Kubernetes技术栈
Stars: ✭ 1,391 (+1237.5%)
Mutual labels:  microservice
Python Microservice Fastapi
Learn to build your own microservice using Python and FastAPI
Stars: ✭ 96 (-7.69%)
Mutual labels:  microservice
Atom Pdf View
Support for viewing PDF files in Atom.
Stars: ✭ 99 (-4.81%)
Mutual labels:  pdf
Pdflayouttextstripper
Converts a pdf file into a text file while keeping the layout of the original pdf. Useful to extract the content from a table in a pdf file for instance. This is a subclass of PDFTextStripper class (from the Apache PDFBox library).
Stars: ✭ 1,369 (+1216.35%)
Mutual labels:  pdf
Loafer
Asynchronous message dispatcher - Currently using asyncio and amazon SQS
Stars: ✭ 104 (+0%)
Mutual labels:  microservice

⛔️ [DEPRECATED]

This project is not actively developed anymore as there are better solutions out there that are headless. I would suggest using https://github.com/alvarcarto/url-to-pdf-api

electron-render-service

Greenkeeper badge Build Status Docker Hub npm

Simple PDF/PNG/JPEG render service, accepts webpage URL and returns the resource.

Alternatively an HTML payload can be POST-ed.

Docker usage

Based on official Debian Jessie image, uses latest electron.

  1. docker run -t -e RENDERER_ACCESS_KEY=secret -p 3000:3000 msokk/electron-render-service
  2. wget -O out.pdf 'http://<node_address>:3000/pdf?accessKey=secret&url=https%3A%2F%2Fgithub.com%2Fmsokk%2Felectron-render-service'

NB: Set bigger shared memory size --shm-size=Xm (default: 64m) if dealing with very heavy pages.

Docker Swarm needs extra configuration to work - --shm-size is not implemented use --mount type=tmpfs,dst=/dev/shm,tmpfs-size=134217728 instead and blank hostname -e HOSTNAME=.

Installation on Debian with Node.js

# Enable contrib packages
sed -i 's/main/main contrib/g' /etc/apt/sources.list

# Install packages needed for runtime
apt-get update && apt-get install -y xvfb libgtk2.0-0 ttf-mscorefonts-installer libnotify4 libgconf2-4 libxss1 libnss3 dbus-x11

# Install from NPM
npm install -g electron-render-service

# Run in virtual framebuffer
RENDERER_ACCESS_KEY=secret xvfb-run --server-args="-screen 0 1024x768x24" electron-render-service

wget -O out.pdf 'http://localhost:3000/pdf?accessKey=secret&url=https%3A%2F%2Fgithub.com%2Fmsokk%2Felectron-render-service'

Endpoints

GET /pdf - Render PDF

Query params (About PDF params):

  • accessKey - Authentication key.
  • url - Full URL to fetch.
  • pageSize - Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter, Tabloid or <width>x<height> in microns (e.g. 210000x297000 for A4)(default: A4)
  • marginsType - Specify the type of margins to use (default: 0)
  • printBackground - Whether to print CSS backgrounds. (default: true)
  • landscape - true for landscape, false for portrait. (default: false)
  • removePrintMedia - Removes any <link media="print"> stylesheets on page before render. (default: false)
  • delay - Specify how many seconds to wait before generating the PDF (default: 0)
  • waitForText - Specify a specific string of text to find before generating the PDF (default: false)

POST /pdf

Identical as above, omit url and provide HTML in request body.

GET /png|jpeg - Render PNG/JPEG

Query params:

  • accessKey - Authentication key.
  • url - Full URL to fetch.
  • quality - JPEG quality. (default: 80)
  • delay - Specify how many seconds to wait before generating the image (default: 0)
  • waitForText - Specify a specific string of text to find before generating the image (default: false)
  • browserWidth - Browser window width (default: rect.width || env.WINDOW_WIDTH, max: 3000)
  • browserHeight - Browser window height (default: rect.height || env.WINDOW_HEIGHT, max: 3000)
  • Clipping rectangle (optional, but all four fields must be defined)
    • clippingRect[x]
    • clippingRect[y]
    • clippingRect[width]
    • clippingRect[height]

POST /png|jpeg

Identical as above, omit url and provide HTML in request body.

GET /stats - Display render pool stats

Query params:

  • accessKey - Generic authentication key is required.

Environment variables

Required
  • RENDERER_ACCESS_KEY or RENDERER_ACCESS_KEY_<suffix> - Secret key for limiting access. Suffixed keys are used as labels in access log for debugging usage.
Optional
  • CONCURRENCY - Number of browser windows to run in parallel (default: 1)
  • TIMEOUT - Number of seconds before request timeouts (default: 30)
  • WINDOW_WIDTH - Default window width (default: 1024)
  • WINDOW_HEIGHT - Default window height (default: 768)
  • HOSTNAME - Hostname to accept Express connections on (default: 0.0.0.0)
  • PORT - (default: 3000)
  • CHROMIUM_CLI_SWITCHES - Comma separated list of Chromium command line switches to append. For example pass ignore-certificate-errors as value to render self-signed pages (at your own risk).

Delayed Rendering

Not all content is loaded once the DOM is loaded, some data can take time because calls are being made via websockets and other methods. You can delay the rendering by either providing a delay value in the query string or you can provide waitForText in the query string.

If you specify waitForText the service will continually scan the loaded URL until the overall timeout is reached. If the text passed to the variable waitForText is found before the timeout, the PDF/image will generate and return.

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