htmltopdf

module
v0.0.0-...-59046d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2018 License: MIT

README

htmltopdf

Convert HTML to PDF. Styling CSS is never fun. The only thing worse is styling a PDF.

Dependencies

Darwin
  • wkhtmltopdf
Linux
  • wkhtmltopdf
  • xvfb-run

Usage

Go Package

import "github.com/robertlestak/htmltopdf"

...

pdfpath, err := htmltopdf.Convert("/path/to/file.html")
if err != nil {
	// handle error
}

// pdfpath is the string path to the generated PDF file

REST Server
cp .env-sample .env
vgo run cmd/htmltopdf/htmltopdf.go
curl http://localhost:6547/convert -f "html=@/path/to/file.html" -o /path/to/file.pdf
Docker Deployment
docker build . -f build/Dockerfile -t htmltopdf:latest
docker run -d -p 6547:6547 htmltopdf:latest

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL