Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support of building pdf from request body #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kirillmakhonin
Copy link

@kirillmakhonin kirillmakhonin commented Jul 20, 2019

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

  • PR adds new endpoint named /body-to-pdf that takes POST http request with text/html body and renders it to PDF.

@codecov
Copy link

codecov bot commented Jul 20, 2019

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% <ø> (ø) ⬆️
api/handlers.go 54.76% <31.25%> (-14.47%) ⬇️

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.

@ilyar
Copy link
Contributor

ilyar commented Jul 20, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants