Giter Site home page Giter Site logo

msokk / electron-render-service Goto Github PK

View Code? Open in Web Editor NEW
102.0 4.0 31.0 2.11 MB

Microservice for rendering PDF/PNG/JPEG from HTML with Electron

License: MIT License

JavaScript 9.03% Dockerfile 0.70% HTML 90.26%
pdf electron html2pdf docker html2image microservice

electron-render-service's Introduction

โ›” [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.

electron-render-service's People

Contributors

aubreyhewes avatar ekristen avatar greenkeeper[bot] avatar mcuelenaere avatar msokk avatar p3k avatar pcornelissen avatar reggino avatar skennedy 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar

electron-render-service's Issues

Feature: ability to serve a temporary static PDF

I'm making something within a Saleforce.com APEX page where I had to use their own AJAX client, where responses are always parsed as text, rather than giving me the option to parse the response as a blob, as I'd normally do with SuperAgent. As a result, I need electron-render-service to send back a temporary URL to the client where they can then perform a simple get to the resource.

I'm working on a PR where the render service saves a file to public/download-[timestamp].pdf. It then returns the URL of the file to the client as JSON. Once the file has been accessed, it is deleted.

I've got it working in the narrow use-case for my client, but I was thinking of turning it into a PR for the project. I've designed it so that there's anther query parameter sendBinaryOrURL which you can set to binary or url, defaulting to binary if you don't provide the parameter (replicating the current flow).

Would you be interested in accepting a PR for this?

PNG / JPG capture glitches: timing issue?

PNG and JPG renders often seem to be taken too early, before electron has finished rendering.

Examples, produced by repeating this request with different browserHeight / browserWidth values:

image

Some also only show a transparent background & a scrollbar:
image

I experimented with triggering the call to capturePage in a ready-to-show event handler, or adding a static delay before this call. Neither eliminated the issue.

An in-range update of eslint is breaking the build ๐Ÿšจ

Version 3.16.1 of eslint just got published.

Branch Build failing ๐Ÿšจ
Dependency eslint
Current Version 3.16.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช


Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v3.16.1
  • ff8a80c Fix: duplicated autofix output for inverted fix ranges (fixes #8116) (#8117) (Teddy Katz)
  • a421897 Docs: fix typo in arrow-parens.md (#8132) (Will Chen)
  • 22d7fbf Chore: fix invalid redeclared variables in tests (#8130) (Teddy Katz)
  • 8d95598 Chore: fix output assertion typos in rule tests (#8129) (Teddy Katz)
  • 9fa2559 Docs: Add missing quotes in key-spacing rule (#8121) (Glenn Reyes)
  • f3a6ced Build: package.json update for eslint-config-eslint release (ESLint Jenkins)
Commits

The new version differs by 8 commits .

  • 589ab67 3.16.1
  • 4fec5b2 Build: package.json and changelog update for 3.16.1
  • ff8a80c Fix: duplicated autofix output for inverted fix ranges (fixes #8116) (#8117)
  • a421897 Docs: fix typo in arrow-parens.md (#8132)
  • 22d7fbf Chore: fix invalid redeclared variables in tests (#8130)
  • 8d95598 Chore: fix output assertion typos in rule tests (#8129)
  • 9fa2559 Docs: Add missing quotes in key-spacing rule (#8121)
  • f3a6ced Build: package.json update for eslint-config-eslint release

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Does not work for me :(

Hi,
very cool idea and make-up of this!
I just gave it a spin but unfortunately, it does not work :(

On startup I see also this but I guess it should not prevent it from working:
#3

The problem is that I just get no response when doing this for example:

http://0.0.0.0:3000/pdf?url=http://www.heise.de&access_key=secret

Also I see this when starting the service:

libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted

Any idea?

headless chrome

Now that headless is about to appear in v59 of Chrome are you going to switch so xvfb can be dropped? It doesn't have paper size etc but that is in review afaik so v60 should be a good bet

Integrate electron-pdf

I've spent some time now using both electron-render-service and electron-pdf. I have some proposals I'd like to offer, and if there is agreement I can perform the work.

Integrate the following features of electron-render-service into electron-pdf and depend fully on electron-pdf as the rendering engine

  1. The window pool functionality
  2. Merge the functionality of renderer.js with electron-pdf
  3. Support for all the different output types.

Features that electron-pdf offers (including ones I've recently submitted)

  1. Automatically setting the browser window size based on the output (i.e. PDF) format
  2. Support for setting cookies in the browser session
  3. The ability for the client to pass any BrowserWindow option currently supported by Electron
  4. Support for rendering markdown sources

Add or change the following in electron-render-service

  1. PPTX generation using officegen
    • And allow a list of JavaScript statements to be executed which will generate N number of images, placed 1 per slide. My use case for this is I have an application that presents slides and a means to navigate through them. I need to export this to a powerpoint deck.
  2. An option to return the location of the file(s) instead of a stream
    • I will be deploying this alongside another application that is responsible for returning the stream to the caller (could be entirely asynchronous)
    • Because Electron returns a buffer and not a stream it makes sense to only hold the document in memory for as long as it takes to persist to the FS.

This makes sense to me because it would allow this project to benefit from enhancements to electron-pdf, while providing a robust and flexible API server for anyone wishing to setup rendering as a service vs. embedding it directly in their application.

An in-range update of eslint-plugin-import is breaking the build ๐Ÿšจ

Version 2.5.0 of eslint-plugin-import just got published.

Branch Build failing ๐Ÿšจ
Dependency eslint-plugin-import
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-import is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 27 commits.

  • c41ed06 bump to v2.5.0
  • 94187a3 bump debug version everywhere
  • 54687d1 resolvers/webpack: v0.8.2
  • dac23a1 eslint-module-utils: v2.1.1 (bumping to re-publish to npm)
  • d92ef43 Merge pull request #696 from eelyafi/new_line_fixer
  • 3f9e4bf [Tests] comment out failing (and probably invalid) test
  • 4067495 Only apps should have lockfiles.
  • ebaa8e3 Merge pull request #873 from lukeapage/patch-3
  • 3268cb1 Fix documentation of newline-after-import example
  • 3c46d30 rollback utils dependency to 2.0.0
  • e3a32ad add yank note to utils change log
  • 089f7f1 add yanking note to root change log
  • dfbe0e7 Upgrade debug version of eslint-module-utils (#844)
  • 3d9c642 Merge branch 'release'
  • b8e9a0b Merge pull request #861 from benmosher/release-2.4.0

There are 27 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Missing "custom" page size

Hi there,

I noticed the argument pageSize is checked to be one of ['A3', 'A4', 'A5', 'Legal', 'Letter', 'Tabloid'], but a custom pageSize is supported by Electron too... Could this be added easily?

An in-range update of supertest is breaking the build ๐Ÿšจ

The devDependency supertest was updated from 3.4.0 to 3.4.1.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

supertest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 9 commits.

  • 8ef3840 3.4.1
  • cea9ff5 Merge pull request #535 from visionmedia/v3.4.1
  • 013caf0 doc(History.md) changelog updated
  • 0d4a6dc Merge pull request #533 from rimiti/publish-only-necessary
  • 9ed4909 chore(package-lock.json) file updated
  • c1a1c37 fix(test/supertest.js) test fixed, message has been updated
  • 87756fb Revert "chore(test/supertest.js) obscure test removed"
  • 9e6851b Revert "chore(test/supertest.js) obscure test removed"
  • ad882c2 chore(.npmignore) only publish necessary files

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Styles not being rendered correctly

I have some HTML content which has a bunch of style definitions inlined into it and when posting the content to electron-render-service, I get a PDF with no style applied to the contents (no colors, alignments, table stylings, etc...).

Are there any kind of limitations when rendering HTML styled content?

An in-range update of eslint-config-airbnb-base is breaking the build ๐Ÿšจ

Version 11.1.2 of eslint-config-airbnb-base just got published.

Branch Build failing ๐Ÿšจ
Dependency eslint-config-airbnb-base
Current Version 11.1.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-airbnb-base is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช


Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

make auth optional

I'm considering this service along with another docker container and would use it from within my private docker network. No auth needed.

An in-range update of electron is breaking the build ๐Ÿšจ

Version 1.6.2 of electron just got published.

Branch Build failing ๐Ÿšจ
Dependency electron
Current Version 1.6.3
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As electron is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you itโ€™s very likely also breaking them.
I recommend you give this issue a very high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช


Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes electron v1.6.2 beta

1.6.2 Release Notes

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

xvfb-run: error: Xvfb failed to start when building Dockerfile

Ooh! Here's an issue that I have no idea how to solve!

When I use the built image on Docker Hub that was built 9 days ago, all works well. But if I build from the Dockerfile using docker build -t electron-render-service . ...

and then run it:

docker run -it electron-render-service

I get: xvfb-run: error: Xvfb failed to start

Any ideas?

An in-range update of electron is breaking the build ๐Ÿšจ

The dependency electron was updated from 4.0.6 to 4.0.7.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

electron is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for electron v4.0.7

Release Notes for v4.0.7

Fixes

  • Fixed defaultId not taking affect when set to 0 and no "cancel" button was present on macOS. #17151
  • Fixed process.versions.chrome reporting the wrong patch version. #17218
  • Fixed webContents.print() not working correctly. #17116
  • Fixed a bug when retrieving security scoped bookmarks in ShowOpenDialog and ShowSaveDialog. #17176
FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! ๐ŸŽŠ

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If youโ€™re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didnโ€™t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didnโ€™t touch job or matrix configurations because these tend to be quite specific and complex, and itโ€™s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what youโ€™re doing it may require additional work or may not be applicable at all. Weโ€™re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, Iโ€™m a humble robot and wonโ€™t feel rejected ๐Ÿค–


FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

403: forbidden following docker example

Running on docker 1.11.12, following the example, replacing localhost for node_address:

docker run -t -e RENDERER_ACCESS_KEY=secret -p 3000:3000 msokk/electron-render-service
wget -o out.pdf http://localhost:3000/pdf?url=https://github.com/msokk/electron-render-service&accessKey=secret

The pdf content returned is:

--2016-08-10 12:28:22-- http://localhost:3000/pdf?url=https://github.com/msokk/electron-render-service
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:3000... connected.
HTTP request sent, awaiting response... 403 Forbidden
2016-08-10 12:28:22 ERROR 403: Forbidden.

What am I missing? thank you

An in-range update of async is breaking the build ๐Ÿšจ

Version 2.5.0 of async just got published.

Branch Build failing ๐Ÿšจ
Dependency async
Current Version 2.4.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

async is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you itโ€™s very likely also breaking them.
I recommend you give this issue a very high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

An in-range update of eslint is breaking the build ๐Ÿšจ

Version 3.17.0 of eslint just got published.

Branch Build failing ๐Ÿšจ
Dependency eslint
Current Version 3.16.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช


Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v3.17.0
  • 4fdf6d7 Update: deprecate applyDefaultPatterns in line-comment-position (#8183) (alberto)
  • 25e5817 Fix: Don't autofix + +a to ++a in space-unary-ops (#8176) (Alan Pierce)
  • a6ce8f9 Build: Sort rules before dumping them to doc files (#8154) (Danny Andrews)
  • 0af9057 Chore: Upgrade to a patched version of mock-fs (fixes #8177) (#8188) (Teddy Katz)
  • bf4d8cf Update: ignore eslint comments in lines-arount-comment (fixes #4345) (#8155) (alberto)
  • dad20ad New: add SourceCode#getLocFromIndex and #getIndexFromLoc (fixes #8073) (#8158) (Teddy Katz)
  • 18a519f Update: let RuleTester cases assert that no autofix occurs (fixes #8157) (#8163) (Teddy Katz)
  • a30eb8d Docs: improve documentation for RuleTester cases (#8162) (Teddy Katz)
  • a78ec9f Chore: upgrade coveralls to ^2.11.16 (#8161) (alberto)
  • d02bd11 Fix: padded-blocks autofix problems with comments (#8149) (alberto)
  • 9994889 Docs: Add missing space to create in no-use-before-define (#8166) (Justin Anastos)
  • 4d542ba Docs: Remove unneeded statement about autofix (#8164) (alberto)
  • 20daea5 New: no-compare-neg-zero rule (#8091) (่–›ๅฎš่ฐ”็š„็Œซ)
  • 4d35a81 Fix: Add a utility to avoid autofix conflicts (fixes #7928, fixes #8026) (#8067) (Alan Pierce)
  • 287e882 New: nonblock-statement-body-position rule (fixes #6067) (#8108) (Teddy Katz)
  • 7f1f4e5 Chore: remove unneeded devDeps linefix and gh-got (#8160) (alberto)
  • ca1694b Update: ignore negative ranges in fixes (#8133) (alberto)
  • 163d751 Docs: lines-around-comment doesn't disallow empty lines (#8151) (alberto)
  • 1c84922 Chore: upgrade eslint-plugin-node (#8156) (alberto)
  • 1ee5c27 Fix: Make RuleTester handle empty-string cases gracefully (fixes #8142) (#8143) (Teddy Katz)
  • 044bc10 Docs: Add details about "--fix" option for "sort-imports" rule (#8077) (Olivier Audard)
  • 3fec54a Add option to ignore property in no-param-reassign (#8087) (Christian Bundy)
  • 4e52cfc Fix: Improve keyword-spacing typescript support (fixes #8110) (#8111) (Reyad Attiyat)
  • 7ff42e8 New: Allow regexes in RuleTester (fixes #7837) (#8115) (Daniel Lo Nigro)
  • cbd7ded Build: display rulesโ€™ meta data in their docs (fixes #5774) (#8127) (Wilson Kurniawan)
  • da8e8af Update: include function name in report message if possible (fixes #7260) (#8058) (Dieter Luypaert)
  • 8f91e32 Fix: ignoreRestSiblings option didn't cover arguments (fixes #8119) (#8120) (Toru Nagashima)
Commits

The new version differs by 29 commits .

  • f882a11 3.17.0
  • 6748c18 Build: package.json and changelog update for 3.17.0
  • 4fdf6d7 Update: deprecate applyDefaultPatterns in line-comment-position (#8183)
  • 25e5817 Fix: Don't autofix + +a to ++a in space-unary-ops (#8176)
  • a6ce8f9 Build: Sort rules before dumping them to doc files (#8154)
  • 0af9057 Chore: Upgrade to a patched version of mock-fs (fixes #8177) (#8188)
  • bf4d8cf Update: ignore eslint comments in lines-arount-comment (fixes #4345) (#8155)
  • dad20ad New: add SourceCode#getLocFromIndex and #getIndexFromLoc (fixes #8073) (#8158)
  • 18a519f Update: let RuleTester cases assert that no autofix occurs (fixes #8157) (#8163)
  • a30eb8d Docs: improve documentation for RuleTester cases (#8162)
  • a78ec9f Chore: upgrade coveralls to ^2.11.16 (#8161)
  • d02bd11 Fix: padded-blocks autofix problems with comments (#8149)
  • 9994889 Docs: Add missing space to create in no-use-before-define (#8166)
  • 4d542ba Docs: Remove unneeded statement about autofix (#8164)
  • 20daea5 New: no-compare-neg-zero rule (#8091)

There are 29 commits in total. See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Error when restarting ERS container

When I stop the ERS container with docker stop electron-render-service and then subsequently start it again with docker run electron-render-service I get the following error message in the logs:

2017-03-02T15:38:40.151926962Z xvfb-run: error: Xvfb failed to start

I currently circumvent this by simply removing the container and running a new one from the image โ€“ but would it be possible to make this work, anyway? Or is this a limitation of Docker?

An in-range update of mocha is breaking the build ๐Ÿšจ

Version 3.3.0 of mocha just got published.

Branch Build failing ๐Ÿšจ
Dependency mocha
Current Version 3.2.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช

Status Details - โŒ **continuous-integration/travis-ci/push** The Travis CI build failed [Details](https://travis-ci.org/msokk/electron-render-service/builds/225141456)

Release Notes coverave

Thanks to all our contributors, maintainers, sponsors, and users! โค๏ธ

As highlights:

  • We've got coverage now!
  • Testing is looking less flaky \o/.
  • No more nitpicking about "mocha.js" build on PRs.

๐ŸŽ‰ Enhancements

  • #2659: Adds support for loading reporter from an absolute or relative path (@sul4bh)
  • #2769: Support --inspect-brk on command-line (@igwejk)

๐Ÿ› Fixes

  • #2662: Replace unicode chars w/ hex codes in HTML reporter (@rotemdan)

๐Ÿ” Coverage

๐Ÿ”ฉ Other

Commits

The new version differs by 89 commits0.

  • fb1687e :ship: Release v3.3.0
  • 1943e02 Add Changelog for v3.3.0
  • 861e968 Refactor literal play-icon hex code to a var
  • 1d3c5bc Fix typo in karma.conf.js
  • 9bd9389 Fix spec paths in test HTML files
  • 0a93024 Adds tests for loading reporters w/ relative/absolute paths (#2773)
  • 73929ad Comment special treatment of '+' in URL query parsing
  • e2c9514 Merge pull request #2769 from igwejk/support_inspect_break_in_opts
  • 038c636 Support --inspect-brk on command-line
  • b4ebabd Merge pull request #2727 from lamby/reproducible-build
  • 882347b Please make the build reproducible.
  • a2fc76c Merge pull request #2703 from seppevs/cover_utils_some_fn_with_tests
  • ed61cd0 cover .some() function in utils.js with tests
  • f42cbf4 Merge pull request #2701 from craigtaub/landingSpec
  • 6065242 use stubbed symbol

There are 89 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Cannot make `waitForText` work with dynamically added text

Rendering the test file below as PDF fails if I define the waitForText argument with foo:

http://localhost:3000/pdf?waitForText=foo&url=http://localhost/test.html&delay=0&accessKey=secret

(The render service actually just goes into a never-ending loop or soโ€ฆ itโ€™s not possible to render another working URL, either.)

However, with waitForText=bar it succeeds:

http://localhost:3000/pdf?waitForText=bar&url=http://localhost/test.html&delay=0&accessKey=secret

Is this a restriction of this option that text is not detected if it is dynamically inserted by JavaScript? Or am I doing something wrong?

From the pull request I understand that it actually should work โ€œif text is loaded via XHR or websocket requests after the inital dom is readyโ€โ€ฆ

Any suggestions?

<html>
        <script>
                setTimeout(function() {
                        var e = document.querySelector('body');
                        e.innerHTML = 'foo';
                }, 3000);
        </script>
        bar
</html>

Provide a way to add/change default fonts and user agent

It doesn't seem possible to change the default font used by the webview for rendering (even if they are installed in the container and available to xvfb). This results in many pages looking different than in other browsers. How can this be set?

Additionally it would be useful to have the user agent definable somewhere, even if it's not per request.

Great project.

An in-range update of eslint is breaking the build ๐Ÿšจ

The devDependency eslint was updated from 5.14.1 to 5.15.0.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v5.15.0
  • 4088c6c Build: Remove path.resolve in webpack build (#11462) (Kevin Partington)
  • ec59ec0 New: add rule "prefer-named-capture-group" (fixes #11381) (#11392) (Pig Fang)
  • a44f750 Upgrade: [email protected] (#11461) (Teddy Katz)
  • d3ce611 Sponsors: Sync README with website (ESLint Jenkins)
  • ee88475 Chore: add utils for rule tests (#11453) (่–›ๅฎš่ฐ”็š„็Œซ)
  • d4824e4 Sponsors: Sync README with website (ESLint Jenkins)
  • 6489518 Fix: no-extra-parens crash when code is "((let))" (#11444) (Teddy Katz)
  • 9d20de2 Sponsors: Sync README with website (ESLint Jenkins)
  • 3f14de4 Sponsors: Sync README with website (ESLint Jenkins)
  • 3d6c770 Sponsors: Sync README with website (ESLint Jenkins)
  • de5cbc5 Update: remove invalid defaults from core rules (fixes #11415) (#11427) (Teddy Katz)
  • eb0650b Build: fix linting errors on master (#11428) (Teddy Katz)
  • 5018378 Chore: enable require-unicode-regexp on ESLint codebase (#11422) (Teddy Katz)
  • f6ba633 Chore: lint all files in the repo at the same time (#11425) (Teddy Katz)
  • 8f3d717 Docs: Add non-attending TSC member info (#11411) (Nicholas C. Zakas)
  • ce0777d Docs: use more common spelling (#11417) (่–›ๅฎš่ฐ”็š„็Œซ)
  • b9aabe3 Chore: run fuzzer along with unit tests (#11404) (Teddy Katz)
  • db0c5e2 Build: switch from browserify to webpack (fixes #11366) (#11398) (Pig Fang)
Commits

The new version differs by 22 commits.

  • b00a5e9 5.15.0
  • c3aebb1 Build: changelog update for 5.15.0
  • 4088c6c Build: Remove path.resolve in webpack build (#11462)
  • ec59ec0 New: add rule "prefer-named-capture-group" (fixes #11381) (#11392)
  • a44f750 Upgrade: [email protected] (#11461)
  • 341140f Revert "Chore: remove devDependency common-tags (#11455)" (#11460)
  • d3ce611 Sponsors: Sync README with website
  • aaba636 Chore: remove devDependency common-tags (#11455)
  • ee88475 Chore: add utils for rule tests (#11453)
  • d4824e4 Sponsors: Sync README with website
  • 6489518 Fix: no-extra-parens crash when code is "((let))" (#11444)
  • 9d20de2 Sponsors: Sync README with website
  • 3f14de4 Sponsors: Sync README with website
  • 3d6c770 Sponsors: Sync README with website
  • de5cbc5 Update: remove invalid defaults from core rules (fixes #11415) (#11427)

There are 22 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Empty PDFs when writing to file using Node.js...

After making a simple HTTP POST using fetch, I write the PDF file in the response to my local file system. However, although the PDF file contains the right structure in terms of header and number of pages, the contents aren't being displayed! Furthermore, if I use some app like Postman and save the resulting PDF in my file system the content is correct. I ran vimdiff between both PDF files (the one which I downloaded with my Node service and the one downloaded by Postman) and they seem to differ on the stream after the "</Filter /FlateDecode " sentence. Am I missing anything? Am I supposed to handle any specific encoding format?
Also, I tried to run the stability unit test cases and both GET and POST requests were failing.

Feature request --- send HTML content

This is awesome! Thanks!

Would it be easy to add an option to allow HTML-content to be sent instead of an URL? Or even multiple pages, like:

<html>
  <body>
    This is page 1
  </body>
</html>
<html>
  <body>
    This is page 2
  </body>
</html>

?

Beware of font issues with latest Electron release

I forked your repo to better suit my needs and customize the Dockerfile. I then updated Electron to the latest 1.6.x release but noticed garbled text in my PDF. I haven't thoroughly tested this but a document with webfonts looked just plain bad. Reverting to 1.4.x was fine. Just letting you know in case you were planning to update. Otherwise your repo is great.

An in-range update of eslint-config-airbnb-base is breaking the build ๐Ÿšจ

Version 11.1.1 of eslint-config-airbnb-base just got published.

Branch Build failing ๐Ÿšจ
Dependency eslint-config-airbnb-base
Current Version 11.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-airbnb-base is โ€œonlyโ€ a devDependency of this project it might not break production or downstream projects, but โ€œonlyโ€ your build or test tools โ€“ preventing new deploys or publishes.

I recommend you give this issue a high priority. Iโ€™m sure you can resolve this ๐Ÿ’ช


Status Details
  • โŒ continuous-integration/travis-ci/push The Travis CI build failed Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot ๐ŸŒด

Feature request: Debian packages

Currently getting this set up and running is a real pain, with services dotted around the place that have to be daemonised, manual install steps, and the like.

Would be really good to get some sort of packaged version of this (releases only, I'd imagine), so that it becomes a simple <add repo> && apt install electron-render-service

(I set up parsoid just prior to this and it was a breeze by comparison!)

An in-range update of electron is breaking the build ๐Ÿšจ

The dependency electron was updated from 4.0.7 to 4.0.8.

๐Ÿšจ View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

electron is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • โŒ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for electron v4.0.8

Release Notes for v4.0.8

Release Notes TBD.

FAQ and help

There is a collection of frequently asked questions. If those donโ€™t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot ๐ŸŒด

Refactor waitForText to use HTML body (allows to wait for non-visual text)

I've got a page with an animation on it, and want to generate a PDF of the page after the animation has finished. I can't use waitForText with a text that's on the page because that generates a PDF from before the animation. So I tried setting a timeout for when the animation should be done that renders a text with style display: none. That text doesn't seem to get picked up though. I tried display: hidden but that text got visibly rendered unfortunately.

Could we please have waitForText detect text with display: none (or some other solution that achieves the goal of triggering the pdf render without being visible on the pdf)?

Async API

Simple POST to callback_url would be the easiest.

Unable to install on Debian 9

Hello
I try install on Debian 9 and crash all the time:

root@WIKI:~# npm install -g electron-render-service
/usr/bin/electron-render-service -> /usr/lib/node_modules/electron-render-service/bin/electron-render-service.js

> [email protected] postinstall /usr/lib/node_modules/electron-render-service/node_modules/electron
> node install.js

/usr/lib/node_modules/electron-render-service/node_modules/electron/install.js:47
  throw err
  ^

Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron-render-service/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-10-16T19_33_36_521Z-debug.log
root@WIKI:~# nodejs -v
v10.12.0
root@WIKI:~# npm -v
6.4.1

Best Regards
TaKeN

Docker Swarm mode misc. points

I'm not sure if these are things to fix but it might help someone else and/or be useful in the readme.

To get this working with swarm mode I had to set HOSTNAME to nothing and use /dev/shm instead of setting shm_size.

docker service create --name ers --mount type=tmpfs,dst=/dev/shm,tmpfs-size=134217728 -e RENDERER_ACCESS_KEY=changeme -e HOSTNAME= --publish 3000:3000 msokk/electron-render-service

Or the compose file:

version: '3'
services:  
    electronrenderservice:
        image: msokk/electron-render-service
        ports:        
            - "3000:3000"
        environment: 
            - RENDERER_ACCESS_KEY=changeme
            - HOSTNAME=
        volumes:
            - /dev/shm:/dev/shm

To test:
http://localhost:3000/pdf?accessKey=changeme&url=http%3A%2F%2Fgoogle.com

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.