Pārlūkot izejas kodu

Add directives for proper conversion into PDF

theenglishway (time) 2 gadi atpakaļ
vecāks
revīzija
0c9348442e
2 mainītis faili ar 18 papildinājumiem un 0 dzēšanām
  1. 1 0
      lib/templates/cv.html.heex
  2. 17 0
      lib/views/layout.ex

+ 1 - 0
lib/templates/cv.html.heex

@@ -19,6 +19,7 @@
     <style>
     <style>
       <%= Layout.resets() |> Phoenix.HTML.raw() %>
       <%= Layout.resets() |> Phoenix.HTML.raw() %>
       <%= Layout.page_css() |> Phoenix.HTML.raw() %>
       <%= Layout.page_css() |> Phoenix.HTML.raw() %>
+      <%= Layout.page_print_css() |> Phoenix.HTML.raw() %>
 
 
       dl {
       dl {
         display: grid;
         display: grid;

+ 17 - 0
lib/views/layout.ex

@@ -94,4 +94,21 @@ defmodule CvGenView.Layout do
       font-size: larger;
       font-size: larger;
     }
     }
     """
     """
+
+  def page_print_css(),
+    do: """
+      @media print {
+        html {
+          background-color: initial;
+        }
+
+        body {
+          width: 100%;
+        }
+
+        .work {
+          break-inside: avoid;
+        }
+      }
+    """
 end
 end