From fba54dec876a8a7fee1361583a9ad26c1fa7c14f Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Wed, 3 Feb 2021 18:17:19 +0100
Subject: [PATCH] Add landscape print stylesheet and ability to switch between
 landscape and portrait mode

---
 aleksis/core/static/print_landscape.css     | 19 +++++++++++++++++++
 aleksis/core/templates/core/base_print.html |  6 ++++--
 2 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 aleksis/core/static/print_landscape.css

diff --git a/aleksis/core/static/print_landscape.css b/aleksis/core/static/print_landscape.css
new file mode 100644
index 000000000..a348ddff6
--- /dev/null
+++ b/aleksis/core/static/print_landscape.css
@@ -0,0 +1,19 @@
+@page {
+    size: A4 landscape;
+}
+
+header {
+    width: 277mm;
+}
+
+
+.print-layout-table, .print-layout-td {
+    width: 277mm;
+    max-width: 277mm;
+    min-width: 277mm;
+}
+
+
+footer {
+    width: 277mm;
+}
diff --git a/aleksis/core/templates/core/base_print.html b/aleksis/core/templates/core/base_print.html
index a229d723e..37868f6f3 100644
--- a/aleksis/core/templates/core/base_print.html
+++ b/aleksis/core/templates/core/base_print.html
@@ -18,11 +18,13 @@
   {% include_css "paper-css" %}
   <link rel="stylesheet" href="{% sass_src 'style.scss' %}"/>
   <link rel="stylesheet" href="{% static "print.css" %}"/>
-
+  {% if landscape %}
+    <link rel="stylesheet" href="{% static 'print_landscape.css' %}"/>
+  {% endif %}
   {% block extra_head %}{% endblock %}
 </head>
 
-<body class="A4 print-body">
+<body class="A4 {% if landscape %}landscape{% endif %} print-body">
 <main class="sheet infinite">
   <div style="margin-top: -10mm;"></div>
 
-- 
GitLab