diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogPrint.java b/app/src/main/java/eu/faircode/email/FragmentDialogPrint.java index f21d5e9fe8..1602dbb028 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogPrint.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogPrint.java @@ -210,12 +210,9 @@ public class FragmentDialogPrint extends FragmentDialogBase { "padding-left: 0; padding-right: 0;")); } - if (print_html_margins) { - Element body = document.body(); - String style = body.attr("style"); - body.attr("style", HtmlHelper.mergeStyles(style, - "margin: 1cm !important;")); // 0.4 inch - } + if (print_html_margins) + document.head().appendElement("style") + .text("@page { margin: 1cm; }"); HtmlHelper.markText(document);