printjs-rpk 1.6.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/dist/print.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://printJS/webpack/universalModuleDefinition","webpack://printJS/webpack/bootstrap","webpack://printJS/./src/index.js","webpack://printJS/./src/js/browser.js","webpack://printJS/./src/js/functions.js","webpack://printJS/./src/js/html.js","webpack://printJS/./src/js/image.js","webpack://printJS/./src/js/init.js","webpack://printJS/./src/js/json.js","webpack://printJS/./src/js/modal.js","webpack://printJS/./src/js/pdf.js","webpack://printJS/./src/js/print.js","webpack://printJS/./src/js/raw-html.js","webpack://printJS/./src/sass/index.scss"],"names":["printJS","print","init","window","Browser","isFirefox","InstallTrigger","isIE","navigator","userAgent","indexOf","document","documentMode","isEdge","StyleMedia","isChrome","context","chrome","isSafari","Object","prototype","toString","call","HTMLElement","toLowerCase","isIOSChrome","addWrapper","htmlData","params","bodyStyle","font","font_size","capitalizePrint","obj","charAt","toUpperCase","slice","collectStyles","element","win","defaultView","elementStyle","styles","getComputedStyle","key","length","targetStyles","targetStyle","targetStylesMatch","getPropertyValue","maxWidth","value","i","addHeader","printElement","headerContainer","createElement","isRawHTML","header","innerHTML","headerElement","headerNode","createTextNode","appendChild","setAttribute","headerStyle","insertBefore","childNodes","cleanUp","showModal","Modal","close","onLoadingEnd","onLoadingStart","URL","revokeObjectURL","printable","event","handler","removeEventListener","onPrintDialogClose","iframe","getElementById","frameId","remove","addEventListener","raw","regexHtml","RegExp","test","printFrame","isHtmlElement","console","error","printableElement","cloneElement","Print","send","clone","cloneNode","childNodesArray","Array","ignoreElements","id","clonedChild","scanStyles","nodeType","tagName","getContext","drawImage","constructor","forEach","src","img","imageStyle","fullyQualifiedSrc","imageWrapper","printTypes","fallbackPrintable","type","properties","gridHeaderStyle","gridStyle","onError","onIncompatibleBrowser","modalMessage","documentTitle","repeatTableHeader","css","style","base64","onPdfOpen","honorMarginPadding","honorColor","args","arguments","undefined","Error","encodeURI","k","show","usedFrame","parentNode","removeChild","srcdoc","isArray","file","info","open","focus","Pdf","Image","Html","RawHtml","Json","map","property","field","displayName","columnSize","jsonToHTML","data","a","n","stringData","split","p","modalStyle","printModal","contentDiv","closeButton","spinner","messageNode","getElementsByTagName","bytesArray","Uint8Array","from","atob","c","charCodeAt","createBlobAndPrint","location","origin","req","XMLHttpRequest","responseType","statusText","status","response","localPdf","Blob","createObjectURL","iframeElement","onload","setTimeout","performPrint","printDocument","contentWindow","contentDocument","body","head","images","loadIframeImages","then","execCommand","e","visibility","left","promises","image","href","loadIframeImage","Promise","all","resolve","pollImage","naturalWidth","complete"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA,IAAMA,OAAO,GAAGC,gDAAK,CAACC,IAAtB;;AAEA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;AACjCA,QAAM,CAACH,OAAP,GAAiBA,OAAjB;AACD;;AAEcA,sEAAf,E;;;;;;;;;;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;AAQD;;AAEcvH,oEAAf,E;;;;;;;;;;;;ACrGA;AAAA;AAAA;AAEe;AACb/F,OAAK,EAAE,eAAC2B,MAAD,EAAS8D,UAAT,EAAwB;AAC7B;AACA9D,UAAM,CAACkE,gBAAP,GAA0BnF,QAAQ,CAAC6C,aAAT,CAAuB,KAAvB,CAA1B;AACA5B,UAAM,CAACkE,gBAAP,CAAwB9B,YAAxB,CAAqC,OAArC,EAA8C,YAA9C,EAH6B,CAK7B;;AACApC,UAAM,CAACkE,gBAAP,CAAwBnC,SAAxB,GAAoC/B,MAAM,CAACgD,SAA3C,CAN6B,CAQ7B;;AACAoB,kDAAK,CAACC,IAAN,CAAWrE,MAAX,EAAmB8D,UAAnB;AACD;AAXY,CAAf,E;;;;;;;;;;;ACFA,uC","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","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","const Browser = {\n // Firefox 1.0+\n isFirefox: () => {\n return typeof InstallTrigger !== 'undefined'\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","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 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 iframe.remove()\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 { collectStyles, addHeader } 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 // 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 { addHeader } 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 // Print image\n Print.send(params, printFrame)\n }\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 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 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 { capitalizePrint, addHeader } 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 // 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","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 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 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 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()) {\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 iframeElement.focus()\n\n // If Edge or IE, try catch with execCommand\n if (Browser.isEdge() || Browser.isIE()) {\n try {\n iframeElement.contentWindow.document.execCommand('print', false, null)\n } catch (e) {\n iframeElement.contentWindow.print()\n }\n } else {\n // Other browsers\n iframeElement.contentWindow.print()\n }\n } catch (error) {\n params.onError(error)\n } finally {\n if (Browser.isFirefox()) {\n // Move the iframe element off-screen and make it invisible\n iframeElement.style.visibility = 'hidden'\n iframeElement.style.left = '-1px'\n }\n\n cleanUp(params)\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'\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 // Print html contents\n Print.send(params, printFrame)\n }\n}\n","// extracted by mini-css-extract-plugin"],"sourceRoot":""}
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "printjs-rpk",
3
+ "homepage": "http://printjs.crabbly.com",
4
+ "description": "A tiny javascript library to help printing from the web.",
5
+ "version": "1.6.0",
6
+ "main": "dist/print.js",
7
+ "types": "src/index.d.ts",
8
+ "repository": "https://github.com/crabbly/Print.js",
9
+ "license": "MIT",
10
+ "devDependencies": {
11
+ "@babel/core": "7.11.6",
12
+ "@babel/preset-env": "7.11.5",
13
+ "babel-loader": "8.1.0",
14
+ "coveralls": "3.1.0",
15
+ "css-loader": "4.2.2",
16
+ "istanbul-instrumenter-loader": "3.0.1",
17
+ "jasmine-core": "3.6.0",
18
+ "karma": "5.2.1",
19
+ "karma-chrome-launcher": "3.1.0",
20
+ "karma-coverage": "2.0.3",
21
+ "karma-jasmine": "4.0.1",
22
+ "karma-phantomjs-launcher": "1.0.4",
23
+ "karma-sourcemap-loader": "0.3.8",
24
+ "karma-webpack": "4.0.2",
25
+ "mini-css-extract-plugin": "0.11.0",
26
+ "node-sass": "4.14.1",
27
+ "optimize-css-assets-webpack-plugin": "5.0.4",
28
+ "sass-loader": "10.0.2",
29
+ "standard": "14.3.4",
30
+ "terser-webpack-plugin": "4.1.0",
31
+ "webpack": "4.44.1",
32
+ "webpack-cli": "3.3.12",
33
+ "webpack-dev-server": "3.11.0"
34
+ },
35
+ "scripts": {
36
+ "test": "standard && karma start",
37
+ "dev": "webpack --mode development --progress --hide-modules --devtool source-map",
38
+ "watch": "webpack --mode development --watch --progress --hide-modules",
39
+ "production": "webpack --mode production --progress --hide-modules",
40
+ "coverage": "open coverage/lcov-report/index.html",
41
+ "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
42
+ "start": "webpack-dev-server --public http://localhost:8080/test/manual --open",
43
+ "standard:fix": "standard --fix"
44
+ },
45
+ "author": "Rodrigo Vieira <rodrigo@crabbly.com>",
46
+ "standard": {
47
+ "ignore": [
48
+ "/dist/print.js"
49
+ ],
50
+ "env": {
51
+ "browser": true,
52
+ "jasmine": true
53
+ }
54
+ },
55
+ "keywords": [
56
+ "printjs",
57
+ "print.js",
58
+ "print-js"
59
+ ]
60
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ declare function printJS(configuration: printJS.Configuration): void;
2
+ declare function printJS(source: string, type?: printJS.PrintTypes): void;
3
+
4
+ declare namespace printJS {
5
+ type PrintTypes = 'pdf' | 'html' | 'image' | 'json' | 'raw-html';
6
+
7
+ interface Configuration {
8
+ printable: any;
9
+ fallbackPrintable?: string;
10
+ type?: PrintTypes;
11
+ documentTitle?: string;
12
+ header?: any;
13
+ headerStyle?: string;
14
+ maxWidth?: number;
15
+ targetStyle?: string | string[];
16
+ targetStyles?: string | string[];
17
+ properties?: any;
18
+ gridHeaderStyle?: string;
19
+ gridStyle?: string;
20
+ showModal?: boolean;
21
+ onLoadingStart?: () => void;
22
+ onLoadingEnd?: () => void;
23
+ modalMessage?: string;
24
+ frameId?: string;
25
+ frameRemoveDelay?: number;
26
+ ignoreElements?: string | string[];
27
+ repeatTableHeader?: boolean;
28
+ css?: string | string[];
29
+ style?: string;
30
+ scanStyles?: boolean;
31
+ onError?: (error: any, xmlHttpRequest?: XMLHttpRequest) => void;
32
+ onPrintDialogClose?: () => void;
33
+ onIncompatibleBrowser?: () => void;
34
+ base64?: boolean;
35
+
36
+ // Deprecated
37
+ onPdfOpen?: () => void;
38
+ font?: string;
39
+ font_size?: string;
40
+ honorMarginPadding?: boolean;
41
+ honorColor?: boolean;
42
+ imageStyle?: string;
43
+ }
44
+ }
45
+
46
+ export = printJS;
package/src/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import './sass/index.scss'
2
+ import print from './js/init'
3
+
4
+ const printJS = print.init
5
+
6
+ if (typeof window !== 'undefined') {
7
+ window.printJS = printJS
8
+ }
9
+
10
+ export default printJS
@@ -0,0 +1,29 @@
1
+ const Browser = {
2
+ // Firefox 1.0+
3
+ isFirefox: () => {
4
+ return typeof InstallTrigger !== 'undefined'
5
+ },
6
+ // Internet Explorer 6-11
7
+ isIE: () => {
8
+ return navigator.userAgent.indexOf('MSIE') !== -1 || !!document.documentMode
9
+ },
10
+ // Edge 20+
11
+ isEdge: () => {
12
+ return !Browser.isIE() && !!window.StyleMedia
13
+ },
14
+ // Chrome 1+
15
+ isChrome: (context = window) => {
16
+ return !!context.chrome
17
+ },
18
+ // At least Safari 3+: "[object HTMLElementConstructor]"
19
+ isSafari: () => {
20
+ return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 ||
21
+ navigator.userAgent.toLowerCase().indexOf('safari') !== -1
22
+ },
23
+ // IOS Chrome
24
+ isIOSChrome: () => {
25
+ return navigator.userAgent.toLowerCase().indexOf('crios') !== -1
26
+ }
27
+ }
28
+
29
+ export default Browser
@@ -0,0 +1,111 @@
1
+ import Modal from './modal'
2
+ import Browser from './browser'
3
+
4
+ export function addWrapper (htmlData, params) {
5
+ const bodyStyle = 'font-family:' + params.font + ' !important; font-size: ' + params.font_size + ' !important; width:100%;'
6
+ return '<div style="' + bodyStyle + '">' + htmlData + '</div>'
7
+ }
8
+
9
+ export function capitalizePrint (obj) {
10
+ return obj.charAt(0).toUpperCase() + obj.slice(1)
11
+ }
12
+
13
+ export function collectStyles (element, params) {
14
+ const win = document.defaultView || window
15
+
16
+ // String variable to hold styling for each element
17
+ let elementStyle = ''
18
+
19
+ // Loop over computed styles
20
+ const styles = win.getComputedStyle(element, '')
21
+
22
+ for (let key = 0; key < styles.length; key++) {
23
+ // Check if style should be processed
24
+ if (params.targetStyles.indexOf('*') !== -1 || params.targetStyle.indexOf(styles[key]) !== -1 || targetStylesMatch(params.targetStyles, styles[key])) {
25
+ if (styles.getPropertyValue(styles[key])) elementStyle += styles[key] + ':' + styles.getPropertyValue(styles[key]) + ';'
26
+ }
27
+ }
28
+
29
+ // Print friendly defaults (deprecated)
30
+ elementStyle += 'max-width: ' + params.maxWidth + 'px !important; font-size: ' + params.font_size + ' !important;'
31
+
32
+ return elementStyle
33
+ }
34
+
35
+ function targetStylesMatch (styles, value) {
36
+ for (let i = 0; i < styles.length; i++) {
37
+ if (typeof value === 'object' && value.indexOf(styles[i]) !== -1) return true
38
+ }
39
+ return false
40
+ }
41
+
42
+ export function addHeader (printElement, params) {
43
+ // Create the header container div
44
+ const headerContainer = document.createElement('div')
45
+
46
+ // Check if the header is text or raw html
47
+ if (isRawHTML(params.header)) {
48
+ headerContainer.innerHTML = params.header
49
+ } else {
50
+ // Create header element
51
+ const headerElement = document.createElement('h1')
52
+
53
+ // Create header text node
54
+ const headerNode = document.createTextNode(params.header)
55
+
56
+ // Build and style
57
+ headerElement.appendChild(headerNode)
58
+ headerElement.setAttribute('style', params.headerStyle)
59
+ headerContainer.appendChild(headerElement)
60
+ }
61
+
62
+ printElement.insertBefore(headerContainer, printElement.childNodes[0])
63
+ }
64
+
65
+ export function cleanUp (params) {
66
+ // If we are showing a feedback message to user, remove it
67
+ if (params.showModal) Modal.close()
68
+
69
+ // Check for a finished loading hook function
70
+ if (params.onLoadingEnd) params.onLoadingEnd()
71
+
72
+ // If preloading pdf files, clean blob url
73
+ if (params.showModal || params.onLoadingStart) window.URL.revokeObjectURL(params.printable)
74
+
75
+ // Run onPrintDialogClose callback
76
+ let event = 'mouseover'
77
+
78
+ if (Browser.isChrome() || Browser.isFirefox()) {
79
+ // Ps.: Firefox will require an extra click in the document to fire the focus event.
80
+ event = 'focus'
81
+ }
82
+
83
+ const handler = () => {
84
+ // Make sure the event only happens once.
85
+ window.removeEventListener(event, handler)
86
+
87
+ params.onPrintDialogClose()
88
+
89
+ // Remove iframe from the DOM
90
+ const iframe = document.getElementById(params.frameId)
91
+
92
+ if (iframe) {
93
+ if (params.frameRemoveDelay) {
94
+ setTimeout(() => {
95
+ iframe.remove()
96
+ },
97
+ params.frameRemoveDelay
98
+ )
99
+ } else {
100
+ iframe.remove()
101
+ }
102
+ }
103
+ }
104
+
105
+ window.addEventListener(event, handler)
106
+ }
107
+
108
+ export function isRawHTML (raw) {
109
+ const regexHtml = new RegExp('<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1>')
110
+ return regexHtml.test(raw)
111
+ }
package/src/js/html.js ADDED
@@ -0,0 +1,70 @@
1
+ import { collectStyles, addHeader } from './functions'
2
+ import Print from './print'
3
+
4
+ export default {
5
+ print: (params, printFrame) => {
6
+ // Get the DOM printable element
7
+ const printElement = isHtmlElement(params.printable) ? params.printable : document.getElementById(params.printable)
8
+
9
+ // Check if the element exists
10
+ if (!printElement) {
11
+ window.console.error('Invalid HTML element id: ' + params.printable)
12
+ return
13
+ }
14
+
15
+ // Clone the target element including its children (if available)
16
+ params.printableElement = cloneElement(printElement, params)
17
+
18
+ // Add header
19
+ if (params.header) {
20
+ addHeader(params.printableElement, params)
21
+ }
22
+
23
+ // Print html element contents
24
+ Print.send(params, printFrame)
25
+ }
26
+ }
27
+
28
+ function cloneElement (element, params) {
29
+ // Clone the main node (if not already inside the recursion process)
30
+ const clone = element.cloneNode()
31
+
32
+ // Loop over and process the children elements / nodes (including text nodes)
33
+ const childNodesArray = Array.prototype.slice.call(element.childNodes)
34
+ for (let i = 0; i < childNodesArray.length; i++) {
35
+ // Check if we are skipping the current element
36
+ if (params.ignoreElements.indexOf(childNodesArray[i].id) !== -1) {
37
+ continue
38
+ }
39
+
40
+ // Clone the child element
41
+ const clonedChild = cloneElement(childNodesArray[i], params)
42
+
43
+ // Attach the cloned child to the cloned parent node
44
+ clone.appendChild(clonedChild)
45
+ }
46
+
47
+ // Get all styling for print element (for nodes of type element only)
48
+ if (params.scanStyles && element.nodeType === 1) {
49
+ clone.setAttribute('style', collectStyles(element, params))
50
+ }
51
+
52
+ // Check if the element needs any state processing (copy user input data)
53
+ switch (element.tagName) {
54
+ case 'SELECT':
55
+ // Copy the current selection value to its clone
56
+ clone.value = element.value
57
+ break
58
+ case 'CANVAS':
59
+ // Copy the canvas content to its clone
60
+ clone.getContext('2d').drawImage(element, 0, 0)
61
+ break
62
+ }
63
+
64
+ return clone
65
+ }
66
+
67
+ function isHtmlElement (printable) {
68
+ // Check if element is instance of HTMLElement or has nodeType === 1 (for elements in iframe)
69
+ return typeof printable === 'object' && printable && (printable instanceof HTMLElement || printable.nodeType === 1)
70
+ }
@@ -0,0 +1,48 @@
1
+ import { addHeader } from './functions'
2
+ import Print from './print'
3
+ import Browser from './browser'
4
+
5
+ export default {
6
+ print: (params, printFrame) => {
7
+ // Check if we are printing one image or multiple images
8
+ if (params.printable.constructor !== Array) {
9
+ // Create array with one image
10
+ params.printable = [params.printable]
11
+ }
12
+
13
+ // Create printable element (container)
14
+ params.printableElement = document.createElement('div')
15
+
16
+ // Create all image elements and append them to the printable container
17
+ params.printable.forEach(src => {
18
+ // Create the image element
19
+ const img = document.createElement('img')
20
+ img.setAttribute('style', params.imageStyle)
21
+
22
+ // Set image src with the file url
23
+ img.src = src
24
+
25
+ // The following block is for Firefox, which for some reason requires the image's src to be fully qualified in
26
+ // order to print it
27
+ if (Browser.isFirefox()) {
28
+ const fullyQualifiedSrc = img.src
29
+ img.src = fullyQualifiedSrc
30
+ }
31
+
32
+ // Create the image wrapper
33
+ const imageWrapper = document.createElement('div')
34
+
35
+ // Append image to the wrapper element
36
+ imageWrapper.appendChild(img)
37
+
38
+ // Append wrapper to the printable element
39
+ params.printableElement.appendChild(imageWrapper)
40
+ })
41
+
42
+ // Check if we are adding a print header
43
+ if (params.header) addHeader(params.printableElement, params)
44
+
45
+ // Print image
46
+ Print.send(params, printFrame)
47
+ }
48
+ }