Print.js: IE11 —— 1.0.61

Created on 19 Aug 2019  Â·  8Comments  Â·  Source: crabbly/Print.js

image

1.0.56 正常

1.0.57开始就是异常

Most helpful comment

@crabbly can you publish a new version to NPM and mark it as v1.0.62 ?. This is related to #343 PR and associated issues: #361 #335 #360

All 8 comments

@crabbly can you publish a new version to NPM and mark it as v1.0.62 ?. This is related to #343 PR and associated issues: #361 #335 #360

Any word on v1.0.62? The print html option for 1.0.61 in IE gives a symbol is undefined error.

@crabbly could you please publish a new version to NPM in order to fix this issue?

Hey guys, I'm sorry for the delay on this. I haven't had much time to support the library.

@natalan The #343 PR is already was already published with 1.0.61. Are you sure this is the same issue?

@crabbly yes, you need to publish it as a new patch version

Done. Published 1.0.63.
Please let me know of any issues.

Thank you

Hi @crabbly thanks for your prompt reply. Unfortunately, the issue in IE11 keeps showing up in a specific case.
The error below appears in when trying to print the content of a bootstrap modal window.
Screen Shot 2019-11-15 at 11 40 43 AM
This line left in the code: console.log(element.nodeType); which is outputting those numbers seen before the error line might help understand the root of the error.
Before the NPM 1.0.63 release, I was able to fix the IE issues by manually updating the print.js file in the dist folder from version 1.0.61. with @natalan patches I found in #343 . These were the two functions I manually modified in version 1.0.61 for it to work in all cases including the bootstrap modal window:
`
function loadIframeImages(images) {
var promises = Array.prototype.slice.call(images).reduce(function (memo, image) {
if (image.src && image.src !== window.location.href) {
memo.push(loadIframeImage(image));
}

  return memo;
}, []);
return Promise.all(promises);

}
function cloneElement(element, params) {
// Clone the main node (if not already inside the recursion process)
var clone = element.cloneNode();

// Loop over and process the children elements / nodes (including text nodes)
const childNodesArray = Array.prototype.slice.call(element.childNodes);
for (let i = 0; i < childNodesArray.length; i++) {
    // Check if we are skiping the current element
    if (params.ignoreElements.indexOf(childNodesArray[i].id) !== -1) {
    continue;
    }

    // Clone the child element
    const clonedChild = cloneElement(childNodesArray[i], params);

    // Attach the cloned child to the cloned parent node
    clone.appendChild(clonedChild);
}

if (params.scanStyles && element.nodeType === 1) {
    clone.setAttribute('style', (0, _functions.collectStyles)(element, params));
}

// Check if the element needs any state processing (copy user input data)
switch (element.tagName) {
    case 'SELECT':
    // Copy the current selection value to its clone
    clone.value = element.value;
    break;
    case 'CANVAS':
    // Copy the canvas content to its clone
    clone.getContext('2d').drawImage(element, 0, 0);
    break;
}

return clone;

}
`
Let me know if I can help you somehow.

Hey guys, a fix for this has been published a few versions ago. Please run npm update to get the latest version. Sorry for the long delay responding to this. Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

galcott picture galcott  Â·  7Comments

DouglasOGarrido picture DouglasOGarrido  Â·  3Comments

zhuyinjing picture zhuyinjing  Â·  7Comments

optone picture optone  Â·  8Comments

josefano picture josefano  Â·  9Comments