esbenp / pdf-bot

🤖 A Node queue API for generating PDFs using headless Chrome. Comes with a CLI, S3 storage and webhooks for notifying subscribers about generated PDFs
MIT License
2.63k stars 142 forks source link

Add a parameter to the request to support postback to the url #23

Closed hairylime closed 5 years ago

hairylime commented 5 years ago

For our use case, the form is a formal document representation of other functionality, as such, there is no need for the overhead of having a static form page created for each instance. Preferable would be to have a template url that can consume a json payload via POST, render the form with the mapped in data, and then pass this data via the same request to pdf bot - basically thinking of having a 3rd optional parameter called formdata, an arbitrary object blob, and having a value in this field changes the request to a post.

This is so compelling for us vs having to instantiate every form prior to making the pdf-bot request, that I may end up forking and implementing, if you are at all interested in a PR...

hairylime commented 5 years ago

Closing this upon digging into the code - I see that a) html-pdf-chrome would have to change for what I'm asking, and b) html-pdf-chrome supports data urls - this gives me an easy way to stage the requests to get what I'm asking for - still will be 2 requests, but no need for intermediate doc identity / storage which is really what I'm after