Thanks a lot, @Oleg.
Sorry the delay in responding…
Though, after some more experimentation, it seems to me, that there is implicitly still an A4 sheet in play. And here is why:
I’m intending to generate a card print file. Here’s the code that should work for this:
<%
const fibery = context.getService('fibery');
const x = await fibery.getEntityById(Entity.Type, Entity.Id, ['CardName']);
//const text = x.CardName.toUpperCase();
const text = "Testy Mc Testface";
%>
<style>
html, body, svg {
margin: 0;
padding: 0;}
html {
border: 1px solid red;}
body {
border: 1px solid blue;}
@media print {
@page {
size: 85.6mm 53.98mm;
margin: 0;
padding: 0;
}
</style>
<svg width="244" height="154" viewBox="0 0 244 154" fill="none" xmlns="http://www.w3.org/2000/svg">
<style>
text {
font-family: Poppins;
font-size: 12px;
font-weight: 500;
fill: blue;}
</style>
<rect width="244" height="154" fill="green"/>
<text x="12" y="132"><%= text %></text>
</svg>
The above yields the following PDF:
When I adjust the page height by 10 via:
@media print {
@page {
size: 85.6mm 530.98mm;
I get the following PDF:
Note, that there is no vertical padding.
Now, if I adjust the page width by a factor 10 too, it scales up:
@media print {
@page {
size: 850.6mm 530.98mm;
Note the bottom margins again:
I’ve tried this in Chrome and Orion (Safari) and it doesn’t—as it shouldn’t—make a difference… it seems like the base paper size used to generate the PDF is still A4.
I’m not sure if this can be fixed in any way. I guess the alternative would be to be able to generate a text file through ha script, then I can generate an SVG file.
Any help is much appreciated!