Sign inSign up

ausybe/services-pdf

By ausybe

•Updated 7 months ago

Image
0

1.2K

ausybe/services-pdf repository overview

⁠README

This repository is used to build the following image

docker pull ausybe/services-pdf:latest

⁠PDF API Service

Service for transforming URLs into PDF files using Puppeteer and Chrome.

⁠Setup

Build and run the Docker container.

You can provide custom configuration via an .env.local.json file. See the .env.example.json file for am example.

The following options are available:

{
  "chrome": {
    "port": The port where Chrome will run
  },
  "drupal": {
    "user": A drupal user name to login with,
    "password": The drupal user password
  },
  "browser": An object with parameters used when launching or connecting to the browser engine using puppeteer,
  "pdf": An object with parameters used when calling the puppeteer.page.pdf method.
}

⁠Usage

Send an HTTP POST request with the following JSON payload to the URL and port where the service is running:

{
  url: 'http://url-to-render-as-pdf.test',
  id : 'an optional ID string. Replaced by a UUID if missing'
}

⁠Development

Note that we specify the platform to keep things compatible when running on ARM.

Build the image:

docker build --platform=linux/amd64 -t ausy/pdf .

Run the container:

docker run --platform=linux/amd64 -p 3000:3000 --mount type=bind,src="$(pwd)/src/.env.example.json",target=/usr/local/services-pdf/.env.local.json ausy/pdf

Request PDF:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'url=https://url-to-download-as-pdf/' http://localhost:3000 --output test.pdf

Tag summary

Content type

Image

Digest

sha256:d188cf93f…

Size

333.6 MB

Last updated

7 months ago

docker pull ausybe/services-pdf