Explorar o código

Add directives for proper conversion into PDF

theenglishway (time) %!s(int64=2) %!d(string=hai) anos
pai
achega
0c9348442e
Modificáronse 2 ficheiros con 18 adicións e 0 borrados
  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>
       <%= Layout.resets() |> Phoenix.HTML.raw() %>
       <%= Layout.page_css() |> Phoenix.HTML.raw() %>
+      <%= Layout.page_print_css() |> Phoenix.HTML.raw() %>
 
       dl {
         display: grid;

+ 17 - 0
lib/views/layout.ex

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