Git Product home page Git Product logo

shuttlepdf's Introduction

shuttlepdf

๐Ÿ“ƒ Smashingly simple, and scalable ("serverless") HTML to PDF conversions using Google Cloud Functions, and Puppeteer.

Getting Started

Prerequisites

  • Ensure you have gcloud installed:
  • Ensure you have authenticated with Google Cloud: gcloud init
  • (Optional) Set your current working project: gcloud config set project <project>

Deployment

  1. Clone / download a copy of this repository
  2. Run ./deploy.sh
  3. Enter yes for "Allow unauthenticated invocations of new function" (unless you want to expose your function privately, and in other ways)
  4. Test it out! e.g. https://<region>-<project>.cloudfunctions.net/pdfByURL?url=https://www.bbc.co.uk

Update deploy.sh to suit your needs (e.g. higher timeouts, different region, more memory, etc).

Performance

It is worth mentioning that the average processing time for a standard web page (using the default 1024MB set in deploy.sh) is between 5-15s.

This can potentially be improved by increasing the memory (as doing so will increase the CPU alongside it).

If you are dealing with lots of requests or if you require lower latencies, you may want to consider running a serverful converter, e.g. https://github.com/gotenberg/gotenberg

We also suggest pairing the serverful converter with a workflow engine like Temporal if you have relatively complex processing pipelines or if you require strong guarantees (SLAs) around conversions.

shuttlepdf's People

Contributors

dependabot[bot] avatar mrsaints avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

shuttlepdf's Issues

Upgrade runtime to nodejs12

Warning: The Node.js 8 runtime version is now deprecated. Starting October 1, 2019, new deployments using this version will not be available. Upgrade your application to use Node.js 10 before October 1, 2019.

Is it possible to run this locally (without google cloud)?

Hi @MrSaints ! Sorry for much disturbing ;)

I would like to run this code on my own server without google. Is that possible?

And, additional question. I am also trying to build it statically with static-link, here is my slightly changed package.json:

Code { "name": "shuttlepdf", "version": "1.0.0", "main": "index.js", "repository": "https://github.com/courtsite/shuttlepdf", "author": "Courtsite ", "license": "MIT", "dependencies": { "puppeteer": "^1.11.0", "electron": "^3.1.13" }, "devDependencies": { "prettier": "^1.15.3", "electron-packager": "^12.1.0", "static-link": "*" }, "scripts": { "fmt": "prettier --write *.js", "clean": "rm -rf build/", "build:prepare": "mkdir -p build/ && cp index.js build/ && cp package.json build/ && cd build/ && npm i --production", "build:linux": "electron-packager build/ shuttlepdf --platform=linux --arch=x64 --electron-version=3.1.13 --out=build/ --overwrite --no-prune", "build": "npm run clean && npm run build:prepare && npm run build:linux", "static-link": "static-link --force" }, "static-link": { "dependencies": { "chalk": "*", "marked": "*", "marked-terminal": "*", "yarn": "^1.1.0", "commander": "^2.9.0", "electron": "3.1.13", "rw": "^1.3.2" } } }

I can't get that to work. But first important is the main issue with google cloud of course or how to run locally...

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.