UNPKG

@foxitsoftware/print-js

Version:

A tiny javascript library to help printing from the web.

1 lines 46.7 kB
{"version":3,"sources":["webpack://printJS/webpack/universalModuleDefinition","webpack://printJS/webpack/bootstrap","webpack://printJS/./src/js/browser.js","webpack://printJS/./src/js/modal.js","webpack://printJS/./src/js/functions.js","webpack://printJS/./src/js/print.js","webpack://printJS/./src/js/pdf.js","webpack://printJS/./src/js/html.js","webpack://printJS/./src/js/raw-html.js","webpack://printJS/./src/js/image.js","webpack://printJS/./src/js/json.js","webpack://printJS/./src/js/init.js","webpack://printJS/./src/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Browser","isFirefox","InstallTrigger","getFirefoxMajorVersion","userAgent","match","navigator","toLowerCase","split","map","x","parseInt","isIE","indexOf","document","documentMode","isEdge","StyleMedia","isChrome","arguments","length","undefined","chrome","isSafari","toString","HTMLElement","isIOSChrome","Modal","show","params","printModal","createElement","setAttribute","contentDiv","closeButton","appendChild","spinner","messageNode","createTextNode","modalMessage","getElementsByTagName","getElementById","addEventListener","close","parentNode","removeChild","capitalizePrint","obj","charAt","toUpperCase","slice","targetStylesMatch","styles","_typeof","addHeader","printElement","headerContainer","isRawHTML","header","innerHTML","headerElement","headerNode","headerStyle","insertBefore","childNodes","addFooter","footerContainer","footer","footerElement","footerNode","footerStyle","lastChild","cleanUp","showModal","onLoadingEnd","onLoadingStart","URL","revokeObjectURL","printable","event","handler","removeEventListener","onPrintDialogClose","iframe","frameId","frameRemoveDelay","setTimeout","remove","raw","RegExp","test","performPrint","iframeElement","focus","contentWindow","execCommand","e","print","error","onError","style","visibility","left","Print","send","printFrame","onload","type","printDocument","contentDocument","body","printableElement","head","images","promises","image","src","location","href","Promise","resolve","pollImage","naturalWidth","complete","loadIframeImage","all","loadIframeImages","Array","from","then","base64","bytesArray","Uint8Array","atob","charCodeAt","createBlobAndPrint","origin","req","XMLHttpRequest","responseType","statusText","status","response","open","data","localPdf","Blob","createObjectURL","nodeType","cloneElement","console","element","clone","cloneNode","childNodesArray","ignoreElements","id","clonedChild","scanStyles","elementStyle","defaultView","getComputedStyle","targetStyles","targetStyle","getPropertyValue","maxWidth","font_size","collectStyles","tagName","getContext","drawImage","constructor","forEach","img","imageStyle","fullyQualifiedSrc","imageWrapper","Error","repeatTableHeader","properties","isArray","field","displayName","columnSize","htmlData","a","gridHeaderStyle","stringData","gridStyle","jsonToHTML","iterator","printTypes","fallbackPrintable","onIncompatibleBrowser","documentTitle","css","onPdfOpen","font","honorMarginPadding","honorColor","args","encodeURI","k","concat","usedFrame","srcdoc","file","info","Pdf","Image","Html","RawHtml","Json","printJS"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAiB,QAAID,IAErBD,EAAc,QAAIC,GACnB,CATD,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,CAAC,EAGxB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,CAAC,GAUX,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,OACf,CAyDA,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,GAEhE,EAGAV,EAAoBgB,EAA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K,WACH0G,EAActL,EAAQ4E,GACtB,MACF,IAAK,OACH2G,EAAWvL,EAAQ4E,GAGzB,ECtKI4G,EAAUpH,EAEM,oBAAXrI,SACTA,OAAOyP,QAAUA,GAGJA,c","file":"print.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"printJS\"] = factory();\n\telse\n\t\troot[\"printJS\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","const Browser = {\n // Firefox 1.0+\n isFirefox: () => {\n return typeof InstallTrigger !== 'undefined'\n },\n getFirefoxMajorVersion: (userAgent) => {\n userAgent = userAgent || navigator.userAgent\n const firefoxVersionRegex = /firefox\\/(\\S+)/\n const match = userAgent.toLowerCase().match(firefoxVersionRegex)\n if (match) {\n return match[1].split('.').map(x => parseInt(x))[0]\n }\n },\n // Internet Explorer 6-11\n isIE: () => {\n return navigator.userAgent.indexOf('MSIE') !== -1 || !!document.documentMode\n },\n // Edge 20+\n isEdge: () => {\n return !Browser.isIE() && !!window.StyleMedia\n },\n // Chrome 1+\n isChrome: (context = window) => {\n return !!context.chrome\n },\n // At least Safari 3+: \"[object HTMLElementConstructor]\"\n isSafari: () => {\n return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 ||\n navigator.userAgent.toLowerCase().indexOf('safari') !== -1\n },\n // IOS Chrome\n isIOSChrome: () => {\n return navigator.userAgent.toLowerCase().indexOf('crios') !== -1\n }\n}\n\nexport default Browser\n","const Modal = {\n show (params) {\n // Build modal\n const modalStyle = 'font-family:sans-serif; ' +\n 'display:table; ' +\n 'text-align:center; ' +\n 'font-weight:300; ' +\n 'font-size:30px; ' +\n 'left:0; top:0;' +\n 'position:fixed; ' +\n 'z-index: 9990;' +\n 'color: #0460B5; ' +\n 'width: 100%; ' +\n 'height: 100%; ' +\n 'background-color:rgba(255,255,255,.9);' +\n 'transition: opacity .3s ease;'\n\n // Create wrapper\n const printModal = document.createElement('div')\n printModal.setAttribute('style', modalStyle)\n printModal.setAttribute('id', 'printJS-Modal')\n\n // Create content div\n const contentDiv = document.createElement('div')\n contentDiv.setAttribute('style', 'display:table-cell; vertical-align:middle; padding-bottom:100px;')\n\n // Add close button (requires print.css)\n const closeButton = document.createElement('div')\n closeButton.setAttribute('class', 'printClose')\n closeButton.setAttribute('id', 'printClose')\n contentDiv.appendChild(closeButton)\n\n // Add spinner (requires print.css)\n const spinner = document.createElement('span')\n spinner.setAttribute('class', 'printSpinner')\n contentDiv.appendChild(spinner)\n\n // Add message\n const messageNode = document.createTextNode(params.modalMessage)\n contentDiv.appendChild(messageNode)\n\n // Add contentDiv to printModal\n printModal.appendChild(contentDiv)\n\n // Append print modal element to document body\n document.getElementsByTagName('body')[0].appendChild(printModal)\n\n // Add event listener to close button\n document.getElementById('printClose').addEventListener('click', function () {\n Modal.close()\n })\n },\n close () {\n const printModal = document.getElementById('printJS-Modal')\n\n if (printModal) {\n printModal.parentNode.removeChild(printModal)\n }\n }\n}\n\nexport default Modal\n","import Modal from './modal'\nimport Browser from './browser'\n\nexport function addWrapper (htmlData, params) {\n const bodyStyle = 'font-family:' + params.font + ' !important; font-size: ' + params.font_size + ' !important; width:100%;'\n return '<div style=\"' + bodyStyle + '\">' + htmlData + '</div>'\n}\n\nexport function capitalizePrint (obj) {\n return obj.charAt(0).toUpperCase() + obj.slice(1)\n}\n\nexport function collectStyles (element, params) {\n const win = document.defaultView || window\n\n // String variable to hold styling for each element\n let elementStyle = ''\n\n // Loop over computed styles\n const styles = win.getComputedStyle(element, '')\n\n for (let key = 0; key < styles.length; key++) {\n // Check if style should be processed\n if (params.targetStyles.indexOf('*') !== -1 || params.targetStyle.indexOf(styles[key]) !== -1 || targetStylesMatch(params.targetStyles, styles[key])) {\n if (styles.getPropertyValue(styles[key])) elementStyle += styles[key] + ':' + styles.getPropertyValue(styles[key]) + ';'\n }\n }\n\n // Print friendly defaults (deprecated)\n elementStyle += 'max-width: ' + params.maxWidth + 'px !important; font-size: ' + params.font_size + ' !important;'\n\n return elementStyle\n}\n\nfunction targetStylesMatch (styles, value) {\n for (let i = 0; i < styles.length; i++) {\n if (typeof value === 'object' && value.indexOf(styles[i]) !== -1) return true\n }\n return false\n}\n\nexport function addHeader (printElement, params) {\n // Create the header container div\n const headerContainer = document.createElement('div')\n\n // Check if the header is text or raw html\n if (isRawHTML(params.header)) {\n headerContainer.innerHTML = params.header\n } else {\n // Create header element\n const headerElement = document.createElement('h1')\n\n // Create header text node\n const headerNode = document.createTextNode(params.header)\n\n // Build and style\n headerElement.appendChild(headerNode)\n headerElement.setAttribute('style', params.headerStyle)\n headerContainer.appendChild(headerElement)\n }\n\n printElement.insertBefore(headerContainer, printElement.childNodes[0])\n}\n\nexport function addFooter (printElement, params) {\n // Create the footer container div\n let footerContainer = document.createElement('div')\n\n // Check if the footer is text or raw html\n if (isRawHTML(params.footer)) {\n footerContainer.innerHTML = params.footer\n } else {\n // Create footer element\n let footerElement = document.createElement('h1')\n\n // Create footer text node\n let footerNode = document.createTextNode(params.footer)\n\n // Build and style\n footerElement.appendChild(footerNode)\n footerElement.setAttribute('style', params.footerStyle)\n footerContainer.appendChild(footerElement)\n }\n\n printElement.insertBefore(footerContainer, printElement.childNodes.lastChild)\n}\n\nexport function cleanUp (params) {\n // If we are showing a feedback message to user, remove it\n if (params.showModal) Modal.close()\n\n // Check for a finished loading hook function\n if (params.onLoadingEnd) params.onLoadingEnd()\n\n // If preloading pdf files, clean blob url\n if (params.showModal || params.onLoadingStart) window.URL.revokeObjectURL(params.printable)\n\n // Run onPrintDialogClose callback\n let event = 'mouseover'\n\n if (Browser.isChrome() || Browser.isFirefox()) {\n // Ps.: Firefox will require an extra click in the document to fire the focus event.\n event = 'focus'\n }\n\n const handler = () => {\n // Make sure the event only happens once.\n window.removeEventListener(event, handler)\n\n params.onPrintDialogClose()\n\n // Remove iframe from the DOM\n const iframe = document.getElementById(params.frameId)\n\n if (iframe) {\n if (params.frameRemoveDelay) {\n setTimeout(() => {\n iframe.remove()\n },\n params.frameRemoveDelay\n )\n } else {\n iframe.remove()\n }\n }\n }\n\n window.addEventListener(event, handler)\n}\n\nexport function isRawHTML (raw) {\n const regexHtml = new RegExp('<([A-Za-z][A-Za-z0-9]*)\\\\b[^>]*>(.*?)</\\\\1>')\n return regexHtml.test(raw)\n}\n","import Browser from './browser'\nimport { cleanUp } from './functions'\n\nconst Print = {\n send: (params, printFrame) => {\n // Append iframe element to document body\n document.getElementsByTagName('body')[0].appendChild(printFrame)\n\n // Get iframe element\n const iframeElement = document.getElementById(params.frameId)\n\n // Wait for iframe to load all content\n iframeElement.onload = () => {\n if (params.type === 'pdf') {\n // Add a delay for Firefox. In my tests, 1000ms was sufficient but 100ms was not\n if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) {\n setTimeout(() => performPrint(iframeElement, params), 1000)\n } else {\n performPrint(iframeElement, params)\n }\n return\n }\n\n // Get iframe element document\n let printDocument = (iframeElement.contentWindow || iframeElement.contentDocument)\n if (printDocument.document) printDocument = printDocument.document\n\n // Append printable element to the iframe body\n printDocument.body.appendChild(params.printableElement)\n\n // Add custom style\n if (params.type !== 'pdf' && params.style) {\n // Create style element\n const style = document.createElement('style')\n style.innerHTML = params.style\n\n // Append style element to iframe's head\n printDocument.head.appendChild(style)\n }\n\n // If printing images, wait for them to load inside the iframe\n const images = printDocument.getElementsByTagName('img')\n\n if (images.length > 0) {\n loadIframeImages(Array.from(images)).then(() => performPrint(iframeElement, params))\n } else {\n performPrint(iframeElement, params)\n }\n }\n }\n}\n\nfunction performPrint (iframeElement, params) {\n try {\n\n // If Edge or IE, try catch with execCommand\n if (Browser.isEdge() || Browser.isIE()) {\n try {\n iframeElement.focus()\n iframeElement.contentWindow.document.execCommand('print', false, null)\n cleanUp(params)\n } catch (e) {\n setTimeout(function(){\n iframeElement.focus()\n iframeElement.contentWindow.print()\n cleanUp(params)\n },1000)\n }\n } else {\n // Other browsers\n setTimeout(function(){\n iframeElement.focus()\n iframeElement.contentWindow.print()\n cleanUp(params)\n },1000)\n }\n } catch (error) {\n params.onError(error)\n } finally {\n if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) {\n // Move the iframe element off-screen and make it invisible\n iframeElement.style.visibility = 'hidden'\n iframeElement.style.left = '-1px'\n }\n\n }\n}\n\nfunction loadIframeImages (images) {\n const promises = images.map(image => {\n if (image.src && image.src !== window.location.href) {\n return loadIframeImage(image)\n }\n })\n\n return Promise.all(promises)\n}\n\nfunction loadIframeImage (image) {\n return new Promise(resolve => {\n const pollImage = () => {\n !image || typeof image.naturalWidth === 'undefined' || image.naturalWidth === 0 || !image.complete\n ? setTimeout(pollImage, 500)\n : resolve()\n }\n pollImage()\n })\n}\n\nexport default Print\n","import Print from './print'\nimport { cleanUp } from './functions'\n\nexport default {\n print: (params, printFrame) => {\n // Check if we have base64 data\n if (params.base64) {\n if (params.printable.indexOf(',') !== -1) {\n //If pdf base64 start with `data:application/pdf;base64,`,Excute the atob function will throw an error.So we get the content after `,`\n params.printable = params.printable.split(',')[1];\n }\n const bytesArray = Uint8Array.from(atob(params.printable), c => c.charCodeAt(0))\n createBlobAndPrint(params, printFrame, bytesArray)\n return\n }\n\n // Format pdf url\n params.printable = /^(blob|http|\\/\\/)/i.test(params.printable)\n ? params.printable\n : window.location.origin + (params.printable.charAt(0) !== '/' ? '/' + params.printable : params.printable)\n\n // Get the file through a http request (Preload)\n const req = new window.XMLHttpRequest()\n req.responseType = 'arraybuffer'\n\n req.addEventListener('error', () => {\n cleanUp(params)\n params.onError(req.statusText, req)\n\n // Since we don't have a pdf document available, we will stop the print job\n })\n\n req.addEventListener('load', () => {\n // Check for errors\n if ([200, 201].indexOf(req.status) === -1) {\n cleanUp(params)\n params.onError(req.statusText, req)\n\n // Since we don't have a pdf document available, we will stop the print job\n return\n }\n\n // Print requested document\n createBlobAndPrint(params, printFrame, req.response)\n })\n\n req.open('GET', params.printable, true)\n req.send()\n }\n}\n\nfunction createBlobAndPrint (params, printFrame, data) {\n // Pass response or base64 data to a blob and create a local object url\n let localPdf = new window.Blob([data], { type: 'application/pdf' })\n localPdf = window.URL.createObjectURL(localPdf)\n\n // Set iframe src with pdf document url\n printFrame.setAttribute('src', localPdf)\n\n Print.send(params, printFrame)\n}\n","import { collectStyles, addHeader, addFooter } from './functions'\nimport Print from './print'\n\nexport default {\n print: (params, printFrame) => {\n // Get the DOM printable element\n const printElement = isHtmlElement(params.printable) ? params.printable : document.getElementById(params.printable)\n\n // Check if the element exists\n if (!printElement) {\n window.console.error('Invalid HTML element id: ' + params.printable)\n return\n }\n\n // Clone the target element including its children (if available)\n params.printableElement = cloneElement(printElement, params)\n\n // Add header\n if (params.header) {\n addHeader(params.printableElement, params)\n }\n\n // Add footer\n if (params.footer) {\n addFooter(params.printableElement, params)\n }\n\n // Print html element contents\n Print.send(params, printFrame)\n }\n}\n\nfunction cloneElement (element, params) {\n // Clone the main node (if not already inside the recursion process)\n const clone = element.cloneNode()\n\n // Loop over and process the children elements / nodes (including text nodes)\n const childNodesArray = Array.prototype.slice.call(element.childNodes)\n for (let i = 0; i < childNodesArray.length; i++) {\n // Check if we are skipping the current element\n if (params.ignoreElements.indexOf(childNodesArray[i].id) !== -1) {\n continue\n }\n\n // Clone the child element\n const clonedChild = cloneElement(childNodesArray[i], params)\n\n // Attach the cloned child to the cloned parent node\n clone.appendChild(clonedChild)\n }\n\n // Get all styling for print element (for nodes of type element only)\n if (params.scanStyles && element.nodeType === 1) {\n clone.setAttribute('style', collectStyles(element, params))\n }\n\n // Check if the element needs any state processing (copy user input data)\n switch (element.tagName) {\n case 'SELECT':\n // Copy the current selection value to its clone\n clone.value = element.value\n break\n case 'CANVAS':\n // Copy the canvas content to its clone\n clone.getContext('2d').drawImage(element, 0, 0)\n break\n }\n\n return clone\n}\n\nfunction isHtmlElement (printable) {\n // Check if element is instance of HTMLElement or has nodeType === 1 (for elements in iframe)\n return typeof printable === 'object' && printable && (printable instanceof HTMLElement || printable.nodeType === 1)\n}\n","import Print from './print'\nimport { addHeader, addFooter } from './functions'\n\nexport default {\n print: (params, printFrame) => {\n // Create printable element (container)\n params.printableElement = document.createElement('div')\n params.printableElement.setAttribute('style', 'width:100%')\n\n // Set our raw html as the printable element inner html content\n params.printableElement.innerHTML = params.printable\n\n // Add header\n if (params.header) {\n addHeader(params.printableElement, params)\n }\n\n // Add footer\n if (params.footer) {\n addFooter(params.printableElement, params)\n }\n\n // Print html contents\n Print.send(params, printFrame)\n }\n}\n","import { addHeader, addFooter } from './functions'\nimport Print from './print'\nimport Browser from './browser'\n\nexport default {\n print: (params, printFrame) => {\n // Check if we are printing one image or multiple images\n if (params.printable.constructor !== Array) {\n // Create array with one image\n params.printable = [params.printable]\n }\n\n // Create printable element (container)\n params.printableElement = document.createElement('div')\n\n // Create all image elements and append them to the printable container\n params.printable.forEach(src => {\n // Create the image element\n const img = document.createElement('img')\n img.setAttribute('style', params.imageStyle)\n\n // Set image src with the file url\n img.src = src\n\n // The following block is for Firefox, which for some reason requires the image's src to be fully qualified in\n // order to print it\n if (Browser.isFirefox()) {\n const fullyQualifiedSrc = img.src\n img.src = fullyQualifiedSrc\n }\n\n // Create the image wrapper\n const imageWrapper = document.createElement('div')\n\n // Append image to the wrapper element\n imageWrapper.appendChild(img)\n\n // Append wrapper to the printable element\n params.printableElement.appendChild(imageWrapper)\n })\n\n // Check if we are adding a print header\n if (params.header) addHeader(params.printableElement, params)\n\n // Check if we are adding a print footer\n if (params.footer) {\n addFooter(params.printableElement, params)\n }\n\n // Print image\n Print.send(params, printFrame)\n }\n}\n","import { capitalizePrint, addHeader, addFooter } from './functions'\nimport Print from './print'\n\nexport default {\n print: (params, printFrame) => {\n // Check if we received proper data\n if (typeof params.printable !== 'object') {\n throw new Error('Invalid javascript data object (JSON).')\n }\n\n // Validate repeatTableHeader\n if (typeof params.repeatTableHeader !== 'boolean') {\n throw new Error('Invalid value for repeatTableHeader attribute (JSON).')\n }\n\n // Validate properties\n if (!params.properties || !Array.isArray(params.properties)) {\n throw new Error('Invalid properties array for your JSON data.')\n }\n\n // We will format the property objects to keep the JSON api compatible with older releases\n params.properties = params.properties.map(property => {\n return {\n field: typeof property === 'object' ? property.field : property,\n displayName: typeof property === 'object' ? property.displayName : property,\n columnSize: typeof property === 'object' && property.columnSize ? property.columnSize + ';' : 100 / params.properties.length + '%;'\n }\n })\n\n // Create a print container element\n params.printableElement = document.createElement('div')\n\n // Check if we are adding a print header\n if (params.header) {\n addHeader(params.printableElement, params)\n }\n\n // Build the printable html data\n params.printableElement.innerHTML += jsonToHTML(params)\n\n // Check if we are adding a print footer\n if (params.footer) {\n addFooter(params.printableElement, params)\n }\n\n // Print the json data\n Print.send(params, printFrame)\n }\n}\n\nfunction jsonToHTML (params) {\n // Get the row and column data\n const data = params.printable\n const properties = params.properties\n\n // Create a html table\n let htmlData = '<table style=\"border-collapse: collapse; width: 100%;\">'\n\n // Check if the header should be repeated\n if (params.repeatTableHeader) {\n htmlData += '<thead>'\n }\n\n // Add the table header row\n htmlData += '<tr>'\n\n // Add the table header columns\n for (let a = 0; a < properties.length; a++) {\n htmlData += '<th style=\"width:' + properties[a].columnSize + ';' + params.gridHeaderStyle + '\">' + capitalizePrint(properties[a].displayName) + '</th>'\n }\n\n // Add the closing tag for the table header row\n htmlData += '</tr>'\n\n // If the table header is marked as repeated, add the closing tag\n if (params.repeatTableHeader) {\n htmlData += '</thead>'\n }\n\n // Create the table body\n htmlData += '<tbody>'\n\n // Add the table data rows\n for (let i = 0; i < data.length; i++) {\n // Add the row starting tag\n htmlData += '<tr>'\n\n // Print selected properties only\n for (let n = 0; n < properties.length; n++) {\n let stringData = data[i]\n\n // Support nested objects\n const property = properties[n].field.split('.')\n if (property.length > 1) {\n for (let p = 0; p < property.length; p++) {\n stringData = stringData[property[p]]\n }\n } else {\n stringData = stringData[properties[n].field]\n }\n\n // Add the row contents and styles\n htmlData += '<td style=\"width:' + properties[n].columnSize + params.gridStyle + '\">' + stringData + '</td>'\n }\n\n // Add the row closing tag\n htmlData += '</tr>'\n }\n\n // Add the table and body closing tags\n htmlData += '</tbody></table>'\n\n return htmlData\n}\n","'use strict'\n\nimport Browser from './browser'\nimport Modal from './modal'\nimport Pdf from './pdf'\nimport Html from './html'\nimport RawHtml from './raw-html'\nimport Image from './image'\nimport Json from './json'\n\nconst printTypes = ['pdf', 'html', 'image', 'json', 'raw-html']\n\nexport default {\n init () {\n const params = {\n printable: null,\n fallbackPrintable: null,\n type: 'pdf',\n header: null,\n headerStyle: 'font-weight: 300;',\n footer: null,\n footerStyle: 'font-weight: 300;',\n maxWidth: 800,\n properties: null,\n gridHeaderStyle: 'font-weight: bold; padding: 5px; border: 1px solid #dddddd;',\n gridStyle: 'border: 1px solid lightgray; margin-bottom: -1px;',\n showModal: false,\n onError: (error) => { throw error },\n onLoadingStart: null,\n onLoadingEnd: null,\n onPrintDialogClose: () => {},\n onIncompatibleBrowser: () => {},\n modalMessage: 'Retrieving Document...',\n frameId: 'printJS',\n frameRemoveDelay: null,\n printableElement: null,\n documentTitle: 'Document',\n targetStyle: ['clear', 'display', 'width', 'min-width', 'height', 'min-height', 'max-height'],\n targetStyles: ['border', 'box', 'break', 'text-decoration'],\n ignoreElements: [],\n repeatTableHeader: true,\n css: null,\n style: null,\n scanStyles: true,\n base64: false,\n\n // Deprecated\n onPdfOpen: null,\n font: 'TimesNewRoman',\n font_size: '12pt',\n honorMarginPadding: true,\n honorColor: false,\n imageStyle: 'max-width: 100%;'\n }\n\n // Check if a printable document or object was supplied\n const args = arguments[0]\n if (args === undefined) {\n throw new Error('printJS expects at least 1 attribute.')\n }\n\n // Process parameters\n switch (typeof args) {\n case 'string':\n params.printable = encodeURI(args)\n params.fallbackPrintable = params.printable\n params.type = arguments[1] || params.type\n break\n case 'object':\n params.printable = args.printable\n params.fallbackPrintable = typeof args.fallbackPrintable !== 'undefined' ? args.fallbackPrintable : params.printable\n params.fallbackPrintable = params.base64 ? `data:application/pdf;base64,${params.fallbackPrintable}` : params.fallbackPrintable\n for (var k in params) {\n if (k === 'printable' || k === 'fallbackPrintable') continue\n\n params[k] = typeof args[k] !== 'undefined' ? args[k] : params[k]\n }\n break\n default:\n throw new Error('Unexpected argument type! Expected \"string\" or \"object\", got ' + typeof args)\n }\n\n // Validate printable\n if (!params.printable) throw new Error('Missing printable information.')\n\n // Validate type\n if (!params.type || typeof params.type !== 'string' || printTypes.indexOf(params.type.toLowerCase()) === -1) {\n throw new Error('Invalid print type. Available types are: pdf, html, image and json.')\n }\n\n // Check if we are showing a feedback message to the user (useful for large files)\n if (params.showModal) Modal.show(params)\n\n // Check for a print start hook function\n if (params.onLoadingStart) params.onLoadingStart()\n\n // To prevent duplication and issues, remove any used printFrame from the DOM\n const usedFrame = document.getElementById(params.frameId)\n\n if (usedFrame) usedFrame.parentNode.removeChild(usedFrame)\n\n // Create a new iframe for the print job\n const printFrame = document.createElement('iframe')\n\n if (Browser.isFirefox()) {\n // Set the iframe to be is visible on the page (guaranteed by fixed position) but hidden using opacity 0, because\n // this works in Firefox. The height needs to be sufficient for some part of the document other than the PDF\n // viewer's toolbar to be visible in the page\n printFrame.setAttribute('style', 'width: 1px; height: 100px; position: fixed; left: 0; top: 0; opacity: 0; border-width: 0; margin: 0; padding: 0')\n } else {\n // Hide the iframe in other browsers\n printFrame.setAttribute('style', 'visibility: hidden; height: 0; width: 0; position: absolute; border: 0')\n }\n\n // Set iframe element id\n printFrame.setAttribute('id', params.frameId)\n\n // For non pdf printing, pass an html document string to srcdoc (force onload callback)\n if (params.type !== 'pdf') {\n printFrame.srcdoc = '<html><head><title>' + params.documentTitle + '</title>'\n\n // Attach css files\n if (params.css) {\n // Add support for single file\n if (!Array.isArray(params.css)) params.css = [params.css]\n\n // Create link tags for each css file\n params.css.forEach(file => {\n printFrame.srcdoc += '<link rel=\"stylesheet\" href=\"' + file + '\">'\n })\n }\n\n printFrame.srcdoc += '</head><body></body></html>'\n }\n\n // Check printable type\n switch (params.type) {\n case 'pdf':\n // Check browser support for pdf and if not supported we will just open the pdf file instead\n if (Browser.isIE()) {\n try {\n console.info('Print.js doesn\\'t support PDF printing in Internet Explorer.')\n const win = window.open(params.fallbackPrintable, '_blank')\n win.focus()\n params.onIncompatibleBrowser()\n } catch (error) {\n params.onError(error)\n } finally {\n // Make sure there is no loading modal opened\n if (params.showModal) Modal.close()\n if (params.onLoadingEnd) params.onLoadingEnd()\n }\n } else {\n Pdf.print(params, printFrame)\n }\n break\n case 'image':\n Image.print(params, printFrame)\n break\n case 'html':\n Html.print(params, printFrame)\n break\n case 'raw-html':\n RawHtml.print(params, printFrame)\n break\n case 'json':\n Json.print(params, printFrame)\n break\n }\n }\n}\n","import './sass/index.scss'\nimport print from './js/init'\n\nconst printJS = print.init\n\nif (typeof window !== 'undefined') {\n window.printJS = printJS\n}\n\nexport default printJS\n"],"sourceRoot":""}