A simple Go/Fiber api that handles generating PDF documents form HTML input or URL endpoints.
`air --build.exclude_dir "public"`
... Documentation to be generated
curl -X POST -H "Content-Type: application/json" --data "{\"title\":\"Test\",\"url\":\"https://nampost.com.na\"}" localhost:3000/url-to-pdf/
`{
"status": "success",
"message": "PDF CReated Successfully",
"error": "",
"filename": "test_101031-04-04.pdf"
}`
curl -X POST -H "Content-Type: application/json" --data "{\"title\":\"Test\",\"html\":\"<div>Html is here</div>\"}" localhost:3000/html-to-pdf/
`{
"status": "success",
"message": "PDF CReated Successfully",
"error": "",
"filename": "test_101045-04-04.pdf"
}`
... TO DO:
- Allow more specific format options, page sizes, dpi, aspect ratios
- Docker image and multi stage build
- Compare speed of webkit vs headless chromium.
- Document the path and including the Webkit binary
- Implement Templ templating, compare vs mustache and plain HTML
- Allow option to respond with raw file data instead of the URL
- Clean HTML input and sanitize
- Clean public/ folder or delete temp files after generating from html
Webkit running older version of CSS. No border radius and other limitations
Rename to aod_pdf_api
Port to echo
Interface iplementation
Pass context into The GeneratePDFDocument ->
Context todo...
Dependency injection...
Understand.
SOLID principles
Loosely Coupled