niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.58k stars 4.81k forks source link

Not working in mac and iOS devices #2388

Open IbnAhmed opened 4 years ago

IbnAhmed commented 4 years ago

Bug reports:

It's working well in Windows, Ubuntu, and Android. But the problem appearing on Mac and all iOS devices. html2canvas start generating then stop suddenly at line number: 6661 and give this following error :

Unhandled Promise Rejection: InvalidStateError: The object is in an invalid state.

My code is like this :

var clone_data = document.querySelector('.clone-dom #contentToConvert');

html2canvas(clone_data, {
    scale: 1, 
    width: 1700,
    height: 2125,
    allowTaint: true, 
    useCORS:true,
}).then(canvas => {
    // save the canvas in image
});

Specifications:

qqwedcrrr commented 4 years ago

Same problem, need help. I've tested with version rc.3 ,rc.4.

omeriko commented 3 years ago

Have you found solution for iOS?

qqwedcrrr commented 3 years ago

Have you found solution for iOS?

FYI, it's ok with the version "1.0.0-alpha.12" for me.

omeriko commented 3 years ago

Have you found solution for iOS?

FYI, it's ok with the version "1.0.0-alpha.12" for me.

Thanks for the tip, i'll try that version on iOS

nxl3477 commented 2 years ago

same problem

talhameer commented 2 months ago

I'm creating HTML to PDF using this package. The HTML preview is perfect as expected on all devices Mac and Windows. But when I make PDF everything goes smoothly on Windows on all browsers. But on Mac, I face some issues related to image placement (zoomed and not positioned centered as it is previewed). On Safari the image is not displayed. Following are the CSS styles that are being applied.

export const ImageWrapper = styled.div`
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1 / 1;
  margin-bottom: 20px;

  img {
    position: absolute;
    width: 100%;
    height: auto;
  }
`;

Please let me know how can I fix this issue.