crabbly / crabbly/Print.js

@page size did not work on raw-html

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

Description

although other style work, but the @page style did not work, i am trying to customize 50mm x 70mm papper it but its keep giving me default page sizze wich is A4 papper
```html



PrintJS

Cetak PDF

function printHtmlCustomStyle() {
const content = `
<div class="page">
<h1>Page 1</h1>
</div>
<div class="page">
<h1>Page 2</h1>
</div>
`;

const style = `
@page {
size: 50mm 70mm;
margin: 0;
}
@media print {
.page {
width: 50mm;
height: 70mm;
page-break-after: always;
border: 1px solid black;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
font-family: Arial, sans-serif;
color: blue;
}
}
`;

printJS({
printable: content,
type: 'raw-html',
style: style,
scanStyles: false
});
}

```

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.