about summary refs log tree commit diff
path: root/pkgs/profpatsch
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-10-05 11:26:43 +0200
committerProfpatsch <mail@profpatsch.de>2021-10-26 20:44:14 +0200
commitf92b2f66402fce1eb607dea26cc71eed8bf8d928 (patch)
tree38b61b35d6a02274c4030dc76ba694fe9031cdd7 /pkgs/profpatsch
parentddb55735b29350fc30419353d964e7bb63de0340 (diff)
pkgs/profpatsch/text-letter: generate PDF with monospace font
This uses the system monospace font to generate a PDF. Before the
printer would be sent a .txt, and it varies from printer to printer
how plain text files are typeset (if at all). Now it only depends on
the system monospace font, which is SourceCode Pro in my case (obvious
TODO is to fix that sometime, or make it configurable).
Diffstat (limited to 'pkgs/profpatsch')
-rw-r--r--pkgs/profpatsch/text-letter.nix11
-rw-r--r--pkgs/profpatsch/text-letter.rs8
2 files changed, 10 insertions, 9 deletions
diff --git a/pkgs/profpatsch/text-letter.nix b/pkgs/profpatsch/text-letter.nix
index f12f0ff2..987bc8dd 100644
--- a/pkgs/profpatsch/text-letter.nix
+++ b/pkgs/profpatsch/text-letter.nix
@@ -1,7 +1,9 @@
 { pkgs, rust-deps, writeRustSimple, writeExecline, getBins }:
 
 let
-  bins = getBins pkgs.coreutils [ "date" "cat" ];
+  bins = getBins pkgs.coreutils [ "date" "cat" ]
+      // getBins pkgs.paps [ "paps" ]
+      // getBins pkgs.ghostscript [ "ps2pdf" ];
 
   mustache-interpol = writeRustSimple "mustache-interpol" {
     dependencies = [
@@ -16,9 +18,16 @@ let
     mustache-interpol
   ];
 
+  text-letter-pdf = writeExecline "write-letter-pdf" {} [
+    "pipeline" [ text-letter ]
+    "pipeline" [ bins.paps "--encoding=utf8" ]
+    bins.ps2pdf "-"
+  ];
+
 in {
    inherit
      mustache-interpol
      text-letter
+     text-letter-pdf
      ;
 }
diff --git a/pkgs/profpatsch/text-letter.rs b/pkgs/profpatsch/text-letter.rs
index 55921adc..1ff3bdf8 100644
--- a/pkgs/profpatsch/text-letter.rs
+++ b/pkgs/profpatsch/text-letter.rs
@@ -83,10 +83,6 @@ fn main() {
 
 
 
-
-
-
-
 {{{from_address_one_line}}}
 
 {{{an}}}
@@ -96,10 +92,6 @@ fn main() {
 
 
 
-
-
-
-
 {{content}}
 "###
     ).expect("the template is malformed");