Skip to content

moonrhythm/pdfserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdfserver

API

Name Value
Method POST
Path /
Content-Type application/json

Body

Name Type Desc Default Example
content string HTML for render to pdf <h1>PDF Server</h1>
scale number Print scale 1.0 1.0
paper PaperSize Paper size A4
margin Margin or number Margin 0.4
background boolean Print Background true false
pageRanges string Page ranges "1-4,7"
header string Header template <span></span>
footer string Footer template <span></span>
cssPageSize boolean Use CSS page size false
landscape boolean Landscape false
wait number Wait time in milliseconds 1000

PaperSize

Name Type
width number
height number

Margin

Name Type
top number
right number
bottom number
left number

Example

POST / HTTP/1.1
Content-Type: application/json; charset=utf-8

{"content":"<h1>PDF Server</h1>","scale":1}

Usage

As a web server

# run
$ go run ./cmd/pdfserver

# generate pdf
$ http :8080 content="<h1>PDF Server</h1>" scale:=1 > file.pdf

Env

Name Desc Default
PORT HTTP Port 8080
CONCURRENT Max Concurrent 5

Build

$ make build
# or
$ go build -o pdfserver .

Docker

$ docker build -t IMAGE .

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published