crabbly / crabbly/Print.js

iPad & iPhone-Chrome/safari browser- Image print 'raw-html' is printing the entire html page and also blank pages

Open
#674 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.5k
Forks
688
PR merge metrics
No merged PRs in 30d

Description

Hi there, I need help on this issue on IOS Devices - iPad and iPhone - chrome and safari browsers
I am using Print-JS for printing of images. Below is my code of how I am calling it.

**Calling printJS:**

```
printJS({
printable: htmlContent,
type: 'raw-html',
style,
documentTitle: '',
showModal: true,
modalMessage: 'Preparing data...',
onError() {
alert('Could not print the document');
},
});
```

Below is the iFrame that Print-JS library has injected into the DOM

**iFrame injected:**

```

#document
<html>
<head>
<title></title>
<style>
@media print {
div.img-container {
overflow:hidden;
page-break-after:always;
page-break-inside: avoid;
}
.catalogImg {
width: 95vw;
height: 95vh;
}
@page {
margin-top: 0;
margin-bottom: 0;
}
}
</style>
</head>
<body>
<div style="width:100%">
<div class="img-container">
<img src="blob:https://ab.dev.abc.com/26922f94-2dfd-436b-aa60-890aff8b815b"
class="cataImg">
</div>
</div>
</body>
</html>

```

**Output on iPad Air Chrome browser:**

**Issue**: Entire page is printed instead of actual image to print.

![entirePage1](https://github.com/crabbly/Print.js/assets/19620022/c03f902e-151c-49dd-9c2c-dc1efa02b839)

![entirePage2](https://github.com/crabbly/Print.js/assets/19620022/ca7203aa-eea9-4641-a873-1923958c2736)

**Output on iPhone 14 Pro Max Safari browser**

**Issue**: Blank white pages are getting printed instead of actual Image.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.