Printing - lmparppei/BeatPlugins GitHub Wiki
Beat.printHTML(htmlString, settings, callback)
Bear in mind that htmlString
is handled as pure HTML. It has no stylization, no headers, no nothing. You will need to provide everything inside the single HTML string, from CSS stylesheet to any required header data, including charset. Avoid using JavaScript for rendering, and preprocess the output as far as possible. If you want to have clean pagination, use CSS rules like page-break-after
when needed.
For now, settings
has only two values:
orientation
— either "landscape"
or "portrait"
(default)
paperSize
: — either "us letter"
or "a4"
(default)
Import a HTML file from inside the plugin folder and print it:
const html = Beat.assetAsString("somefile.html")
Beat.printHTML(html, {
orientation: "landscape", // default is portrait
paperSize: "a4" // default SHOULD be document setting
}, function() {
// Optional callback
})
Bare-bones printing:
Beat.printHTML("<h1>Hello World!</h1>")