arachnys / athenapdf

Drop-in replacement for wkhtmltopdf built on Go, Electron and Docker
MIT License
2.26k stars 187 forks source link

Convert with html in request body #180

Closed mmaryo closed 5 years ago

mmaryo commented 5 years ago

Hello

I would be great to convert an html String directely by using url

POST http://localhost:8080/convert?auth=arachnys-weaver Params: html=Hello

Thanks

POD666 commented 5 years ago

In python you can do it with

html_str = "<html>...</html>"
resp = requests.post(
    "http://localhost:8080/convert",
    params={"auth": "arachnys-weaver"},
    files={"file": ("input.html", html_str)},
)

For curl: curl -F "file=@path-to-file.html" http://localhost:8080/convert?auth=arachnys-weaver

mmaryo commented 5 years ago

Thanks And it would be great to be able to put html content as request body

MrSaints commented 5 years ago

You can already convert HTML via a POST request body. As for converting via a string from the URL parameter, I will have to veto this as most browsers do not support URLs with > 2000 characters, and I just don't think it's an appropriate way to transfer a "file" for conversion.

set-webmaster commented 5 years ago

You can already convert HTML via a POST request body.

@MrSaints Could you point me to where I could find examples of generating a pdf from a POST request?

I can't figure out how to perform the request so that it works, it keeps saying "Invalid file provided"

Thanks in advance!