react-to-print icon indicating copy to clipboard operation
react-to-print copied to clipboard

MS Edge Error: The operation was canceled by the user.

Open bhoroniecki opened this issue 6 years ago • 14 comments

When we want to print table of images ( tags) then "Out of memory exception" on MS Edge it thrown.

bhoroniecki avatar Jan 16 '19 12:01 bhoroniecki

Hi, and thanks for the report. Do you mind sharing some example code please for us to look at?

MatthewHerbst avatar Jan 16 '19 20:01 MatthewHerbst

Hi @bhoroniecki Any chance you could update us on this please?

MatthewHerbst avatar Feb 26 '19 12:02 MatthewHerbst

We are facing same issue. Was this resolved? Is there any alternate solution for this?

ShreyaPrabhu avatar Mar 07 '19 09:03 ShreyaPrabhu

@ShreyaPrabhu any chance you could make a codepen or something please that shows a minimum reproduction of this? No one has posted any code examples so I don't even know where to begin looking for this one

MatthewHerbst avatar Mar 07 '19 20:03 MatthewHerbst

Closing this as stale since there has been no response. Happy to re-open if someone provided more details.

MatthewHerbst avatar Mar 27 '19 18:03 MatthewHerbst

I'm also seeing the same issue on edge. This is my code for App.js in a simple create-react-app

import React from 'react';
import ReactToPrint from 'react-to-print'

export default class App extends React.Component {
  render () {
    return (
      <div className="App">
        <header className="App-header">
          <p>
            Edit <code>src/App.js</code> and save to reload.
          </p>
          <div>
          <ReactToPrint
            trigger={() => <button>Print this out!</button>}
            content={() => this.componentRef}
          />
          <PrintComponent ref={el => (this.componentRef = el)} />
          </div>
        </header>
      </div>
    );
  }
}

class PrintComponent extends React.Component {  
  render() {
    return (
      <table>
        <img src="https://www.gstatic.com/webp/gallery3/1.png" />
        <tbody>
          <tr>
            <td>data 1</td>
            <td>data 2</td>
            <td>data 3</td>
          </tr>
        </tbody>
      </table>
    )
  }
}

I'm also seeing multiple messages saying "The operation was canceled by the user." Not sure if I'm just missing something but help would be appreciated! Thanks.

nathanwsu avatar Jan 27 '20 17:01 nathanwsu

I am able to reproduce using your code on Edge via Browserstack.

The error is very vague.

SCRIPT 1223: The operation was cancelled by the user

So far the only related thing I've been able to find while searching is this: https://stackoverflow.com/questions/43378202/ms-edge-window-open-gives-error-the-operation-was-canceled-by-the-user

While we do open an iframe, we don't give it a url so I don't think that can be our problem. We do use canvas to load images, so it's possible there is an Edge specific problem there.

MatthewHerbst avatar Jan 28 '20 06:01 MatthewHerbst

I have the same problem, for some reason the print mode opens and if I click "cancel" my page freezes. I could open the print window only if I set the copyStyles = {false} attribute if it is the true default, the print window does not open and the page freezes. I did not find any workaround for this so please if you have some way to fix this let me know. Thank you! (sorry for my bad English)

mariagarciaflores avatar Jan 29 '20 14:01 mariagarciaflores

@mariagarciaflores to be sure, that's when using Edge, correct?

MatthewHerbst avatar Jan 29 '20 20:01 MatthewHerbst

@MatthewHerbst I agree that it does seem to be an Edge specific issue as all other browsers seem to print fine. I was wondering if anyone has found a workaround to this issue? Or possibly some other approach?

nathanwsu avatar Jan 31 '20 22:01 nathanwsu

@mariagarciaflores to be sure, that's when using Edge, correct?

Yes, it happens in Edge browser. Still trying to find some workaround. If you have something, it will be helpful.

mariagarciaflores avatar Feb 04 '20 15:02 mariagarciaflores

Is this error still occurring? I'll try and take another stab at it if it's still a problem

MatthewHerbst avatar Jan 01 '21 03:01 MatthewHerbst

Hi, I got the same problem not only Edge but also Opera. Firefox and Safari works well but Chrome may not render all iframes if the number is huge, and IE is the best. It crashes.

Also, there is a hacky solution for opera and chrome and probably edge. It is old but maybe works. https://stackoverflow.com/questions/1648594/print-iframe-content-in-opera-and-chrome

mehmetakify avatar Apr 06 '21 23:04 mehmetakify

Chrome may not render all iframes if the number is huge

We only render/print a single iframe thankfully. Thanks for that link!

MatthewHerbst avatar Apr 07 '21 01:04 MatthewHerbst

Have not had reports of this in some time. Going to close for now, please let me know if this is still an issue.

MatthewHerbst avatar Sep 22 '23 07:09 MatthewHerbst