From 557b4fd83cb2422706067f839ad7c171144d2ad1 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 26 Sep 2024 19:39:37 +0200 Subject: [PATCH] Improved print margings --- .../main/java/eu/faircode/email/FragmentDialogPrint.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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);