Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/buivuanh/pdf-export
Export PDF using playwright and go template
https://github.com/buivuanh/pdf-export
gotemplate pdf-export playwright playwright-go
Last synced: 3 months ago
JSON representation
Export PDF using playwright and go template
- Host: GitHub
- URL: https://github.com/buivuanh/pdf-export
- Owner: buivuanh
- Created: 2024-07-29T03:03:09.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-07T07:46:24.000Z (6 months ago)
- Last Synced: 2024-10-31T09:50:18.805Z (3 months ago)
- Topics: gotemplate, pdf-export, playwright, playwright-go
- Language: HTML
- Homepage:
- Size: 1.05 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pdf-export
## Structure
`/html`: html, template, css, json data files.
`output`: contain output pdf files.
`slide`: slide.
`main.go`: logic code.
## Quick start
Build binary:
`go build`
### Render static html:
```
./pdf-export e -p=html -t=static_data.html
````-p`: workdirectory
`-t`: main html file with a path is workdirectory/main.html, eg: html/static_data.html
### Render html with given json file:
```
./pdf-export e -p=html -t=template.html -d=data.json
````-p`: work directory
`-t`: main html file with a path is workdirectory/main.html, eg: html/template.html
`-d`: json file with a path is workdirectory/data.json, eg: html/data.json.html
To add images or any file into html/css, you can:
- Inline file's data, e.g: ```background: url('data:image/svg+xml;utf8,%3Csvg%20width%3D%22260%2```
- Or put into `/html` directory, a static file server will run at port 8181 when u run `./pdf-export`. E.g: `http://localhost:8181/logo.svg`## Run Slide local
```shell
go get -u golang.org/x/tools/presentpresent
```Open http://127.0.0.1:3999 in chrome.