documents icon indicating copy to clipboard operation
documents copied to clipboard

feat: add support of building pdf from request body

Open kirillmakhonin opened this issue 6 years ago • 2 comments

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-pdf that takes POST http request with text/html body and renders it to PDF.

kirillmakhonin avatar Jul 20 '19 11:07 kirillmakhonin

Codecov Report

Merging #22 into master will decrease coverage by 5.68%. The diff coverage is 31.25%.

Impacted file tree graph

@@            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 data Powered by Codecov. Last update c62ecbc...783644a. Read the comment docs.

codecov[bot] avatar Jul 20 '19 11:07 codecov[bot]

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

ilyar avatar Jul 20 '19 15:07 ilyar