feat: add support of building pdf from request body
Summary
This PR adds possibility to create PDF files direct from HTML files. It might be helpful if you are rendering such types of PDFs like invoices and etc..
This PR implements the following features
- [x] PR adds new endpoint named
/body-to-pdfthat takes POST http request withtext/htmlbody and renders it to PDF.
Codecov Report
Merging #22 into master will decrease coverage by
5.68%. The diff coverage is31.25%.
@@ Coverage Diff @@
## master #22 +/- ##
==========================================
- Coverage 93.75% 88.06% -5.69%
==========================================
Files 8 8
Lines 160 176 +16
==========================================
+ Hits 150 155 +5
- Misses 6 13 +7
- Partials 4 8 +4
| Impacted Files | Coverage Δ | |
|---|---|---|
| api/routers.go | 100% <ø> (ø) |
:arrow_up: |
| api/handlers.go | 54.76% <31.25%> (-14.47%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update c62ecbc...783644a. Read the comment docs.
Thank you for your request.
Already have this behavior GET /html-to-pdf?content=<html><body><h1>test</h2></body></html>, but this solution is limited to the maximum URL size.
I suggest in this request to remake from:
GET /html-to-pdf?content=<html><body><h1>test</h2></body></html>
and
GET /html-to-pdf?content=URL
into
POST /html-to-pdf
<html><body><h1>test</h2></body></html>
and
GET /url-to-pdf/:url