Sign inSign up

txn2/txpdf

By txn2

•Updated about 3 years ago

An API endpoint that returns PDF documents from web based POST requests.

Image
1

6.8K

txn2/txpdf repository overview

Docker Container Pulls

⁠txPDF

txPDF⁠ is an HTML to PDF microservice by txn2⁠. txPDF⁠ is built on top of the n2pdf⁠ container exposing an API endpoint that returns a PDF document from web based POST request.

Example Post Body:

{
  "options": {
    "print_media_type": true
  },
  "pages": [
    {
      "Location": "https://www.example.com"
    }
  ]
}

If you want to convert web pages to PDF but do not need a web service you can use the n2pdf⁠ container directly as a command line tool.

⁠Docker Use

Run the txPDF Docker container⁠ on your local workstation for testing. Forward port 8080 or any free port to txPDFs default service port 8080 on the container.

docker run --rm -p 8080:8080 -e DEBUG=true txn2/txpdf

⁠Curl Test

curl -d "@examples/days.json" -X POST http://localhost:8080/getPdf --output test.pdf

txPDF⁠ can be configured with the following environment variables:

VariableDefaultPurpose
PORT8080Server listen port
DEBUGfalseVerbose logging
BASE_PATHBase path for routes. Prepends onto web service routes BASE_PATH/getPdf and BASE_PATH/status
TOC_XSLPath to XSL transformation script for Table of Contents (example ./toc.xsl. Container holds a default ./toc.xsl

⁠Test

curl -d "@examples/multi-site.json" -X POST http://localhost:8080/getPdf --output test.pdf

Tag summary

Content type

Image

Digest

Size

55.1 MB

Last updated

about 8 years ago

docker pull txn2/txpdf