@vivliostyle/print 2.26.0 → 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,6 +30,7 @@ const htmlDoc = `<!doctype html>
30
30
  config = {
31
31
  title: 'my printed page',
32
32
  printCallback: iframeWin => iframeWin.print() // optional: only needed if calling something other than window.print() for printing.
33
+ errorCallback: message => alert(message) // optional: only needed if you want to handle errors.
33
34
  }
34
35
 
35
36
  printHTML(htmlDoc, config)
package/demo/index.js CHANGED
@@ -21,11 +21,15 @@ document.getElementById('print').addEventListener('click', () => {
21
21
  const pageCount = iframeWin.document.querySelectorAll('[data-vivliostyle-page-container]').length
22
22
  console.log(`page count: ${pageCount}`)
23
23
  iframeWin.print()
24
+ },
25
+ errorCallback = message => {
26
+ alert(message)
24
27
  }
25
28
 
26
29
  printHTML(htmlDoc, {
27
30
  title,
28
31
  printCallback,
32
+ errorCallback,
29
33
  hideIframe: true, // Whether to use a hidden iframe (default: true)
30
34
  removeIframe: true // Whether to remove the iframe after use (default: true)
31
35
  })