Skip to content

This app is a PDF generator, its purpose is to convert web pages to documents.

Notifications You must be signed in to change notification settings

Iteatime/url-to-pdf

Repository files navigation

URL to PDF

This app is a PDF generator, its purpose is to convert web pages to documents. Here you will find sources, Dockerfile and Google Cloud Build configuration files. It uses Puppeteer, check out these instructions to learn more.

How To start:

  • Here you'll have two choices run on our docker environment or on your local one.
  • By default, it runs on localhost:8080/?url=<page_url>[&api=<api_key>].

1 Local

1.1 Requirements:

  • Node.js (at least version 14.x): latest
  • nodemon (optional): npm install -g nodemon
  • ts-node: npm install -g ts-node typescript

1.2 Installation:

  • Here you have to clone this repo then you can run: npm install
  • Then you can add your API key as API_KEY environment variable.

1.3 Dev server:

  • If you chosed to install nodemon you can run the watch via: npm run dev
  • Else you can start without the watch via: npm start

2 Docker

2.1 Requirements:

2.2 Installation:

  • To build the docker image run the file: docker.build.sh.

2.3 Dev server:

  • You can start the watch by running the file: docker.run.sh [api-key].

Continous deployment:

The code pushed on this repo is continously deployed to App Engine.

master is the production branch. What you push there is built and sent live here.

Any other branch or pull request will be automatically deployed too. Check out Google Cloud Build to learn more.

Manual deployment:

You can deploy manualy this app using the Cloud SDK by running this command: gcloud builds submit --config cloudbuild.manual.yaml .

Params:

You can customize the pdf setting by using those query parms:

  • title: the document title,
  • format: the document format,
  • scale: the scale to witch is rendered the page,
  • margin.top: the top margin,
  • margin.left: the left marging,
  • margin.bottom: the bottom margin,
  • margin.right: the right margin,
  • async: set to true to wait page data's

They're discribed on the Puppeteer API doc

About

This app is a PDF generator, its purpose is to convert web pages to documents.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •