Explorar el Código

Add directives for proper conversion into PDF

theenglishway (time) hace 2 años
padre
commit
0c9348442e
Se han modificado 2 ficheros con 18 adiciones y 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