As of now the only options available for input are content and url. Inputing a content causes it to be compiled by handlebars which is an extra step that might not be necessary. I propose adding the following inputs
html: A raw html (could be a compiled handlebars template or a raw html file content). It would just load it in the browser without further computations, its an optimization on the content as it will avoid recompiling against handlebars something that might not be necessary
template: A handlebars uncompiled html that the library would compile internally it play well with properties (see below)
path: A file path the library will load and compile against handlebars. It will also take properties (see below)
properties: An object used to fill the handlebars templates, this abstracts the client from having to use handlebars manually
The only issues I saw is that when using template and path the content can't contain custom handlebars helpers, but in that case the consumers would have to use html which is just a replacement of content.
With the above properties it's possible to deprecate content as it can be replaced by any of the above but with the consumers knowledge of whats going on.
I'd be happy to create a PR for this, but I'd like your input @mrafiqk
@mrafiqk could you please provide example how to use preferCSSPageSize: true. I mean where i should paste @page{size: ...} to work it when generating pdf.
As of now the only options available for input are
content
andurl
. Inputing acontent
causes it to be compiled by handlebars which is an extra step that might not be necessary. I propose adding the following inputshtml
: A raw html (could be a compiled handlebars template or a raw html file content). It would just load it in the browser without further computations, its an optimization on thecontent
as it will avoid recompiling against handlebars something that might not be necessarytemplate
: A handlebars uncompiled html that the library would compile internally it play well withproperties
(see below)path
: A file path the library will load and compile against handlebars. It will also takeproperties
(see below)properties
: An object used to fill the handlebars templates, this abstracts the client from having to use handlebars manuallyThe only issues I saw is that when using
template
andpath
the content can't contain custom handlebars helpers, but in that case the consumers would have to use html which is just a replacement of content.With the above properties it's possible to deprecate content as it can be replaced by any of the above but with the consumers knowledge of whats going on.
I'd be happy to create a PR for this, but I'd like your input @mrafiqk