should have everything important, not tested on a real printer yet

This commit is contained in:
Gwendolyn 2022-08-27 19:57:45 +02:00
commit e712e9acdf
5 changed files with 338 additions and 0 deletions

BIN
blau.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

3
preview.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
color="$1"
gs -dSAFER -r300 -sDEVICE=pngalpha -o ${color}-output.png rezept.ps && convert ${color}.png ${color}-output.png -composite ${color}-preview.png && coreimage ${color}-preview.png

335
rezept.ps Normal file
View file

@ -0,0 +1,335 @@
%!PS
% vim: ts=4 sw=4:
%%%%%%%%%%%%%%%%% CUSTOMISATION BEGIN %%%%%%%%%%%%%%%%%
% Rp1, Rp2 and Rp3 sind die Verordnungen
% string für einzeilige Verordnung, array für mehrzeilige Verordnung (bis zu drei Zeilen), false für durchstreichen
% alle anderen werte werden ignoriert
% RpXAutIdem auf false setzen um das entsprechende Feld anzukreuzen
<<
/Krankenkasse (Krankenkasse)
/Name (Nachname)
/Vorname (Vorname Zweitname)
/Adresse1 (Strasse 1312)
/Adresse2 (D 12345 Stadt)
/GebAm (01.01.1970)
/Kostentraegerkennung (123456789)
/VersichertenNr (Z123456789)
/Status (XYZ)
/BetriebsstaettenNr (234567)
/ArztNr (654321)
/Datum (01.01.1970)
/Rp1 [(Eine Zeile)]
/Rp1AutIdem false
/Rp2 [(Zwei) (Zeilen)]
/Rp2AutIdem true
/Rp3 [(Und) (Drei) (Zeilen)]
/Rp3AutIdem false
/Font /Courier
/FontSize 10
/FontSize1Line 10 % used for 1-line medications
/FontSize2Line 8 % used for 2-line medications
/FontSize3Line 6 % used for 3-line medications
>> begin
%%%%%%%%%%%%%%%%%% CUSTOMISATION END %%%%%%%%%%%%%%%%%%
% convert cm to points
/cm % number -> number
{
72 mul
2.54 div
} bind def
% concatenate two strings
/concat % string string -> string
{
exch dup length
2 index length add string
dup dup 4 2 roll copy length
4 -1 roll putinterval
} bind def
% load the elements of an array variable into the stack
/loadarr % name -> any...
{
load % load the array onto the stack
aload % load array elements onto the stack
pop % remove array itself from stack
} bind def
% calculate the height of a text, with the current font
/textheight % text -> real
{
0 0 moveto
true charpath pathbbox
exch pop
exch sub
exch pop
} bind def
/setfontsize
{
/Font load
exch
selectfont
} bind def
<<
/PageWidth 14.8 cm
/PageHeight 10.5 cm
/PosKrankenkasse [1.0 cm 9.2 cm]
/PosName [1.0 cm 8.5 cm]
/PosVorname [1.0 cm 8.0 cm]
/PosAdresse1 [1.0 cm 7.6 cm]
/PosAdresse2 [1.0 cm 7.2 cm]
/PosGebAm [6.7 cm 7.7 cm]
/PosKostentraegerkennung [1.0 cm 6.3 cm]
/PosVersichertenNr [4 cm 6.3 cm]
/PosStatus [7.2 cm 6.3 cm]
/PosBetriebsstaettenNr [1.0 cm 5.4 cm]
/PosArztNr [3.9 cm 5.4 cm]
/PosDatum [6.7 cm 5.4 cm]
/FieldRp1 [1.0 cm 4.0 cm 7.7 cm 0.8 cm]
/PosAutIdemRp1 [0.4 cm 4.2 cm]
/FieldRp2 [1.0 cm 3.15 cm 7.7 cm 0.8 cm]
/PosAutIdemRp2 [0.4 cm 3.35 cm]
/FieldRp3 [1.0 cm 2.3 cm 7.7 cm 0.8 cm]
/PosAutIdemRp3 [0.4 cm 2.5 cm]
/SimpleFields [(Krankenkasse) (Name) (Vorname) (Adresse1) (Adresse2) (GebAm) (Kostentraegerkennung) (VersichertenNr) (Status) (BetriebsstaettenNr) (ArztNr) (Datum)]
/RpFields [(Rp1) (Rp2) (Rp3)]
>> begin
<<
/PageSize [/PageWidth load /PageHeight load]
/PageOffset [0 0]
/Margins [0 0]
>> setpagedevice
/FontSize load setfontsize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/SimpleFields load
{
dup
(Pos) exch concat cvn
loadarr
moveto
cvn
load
show
} forall
/rpField1Line
{
/FontSize1Line load setfontsize
<<
/boundingBox []
/text ()
>> begin
/text exch store
/boundingBox exch store
/boundingBox load 0 get
/boundingBox load 1 get
/boundingBox load 3 get
/text load textheight
sub
2 div
add
moveto
/text load
show
end
/FontSize load setfontsize
} bind def
/rpField2Line
{
/FontSize2Line load setfontsize
<<
/boundingBox []
/text1 ()
/text2 ()
/padding 0
>> begin
/text2 exch store
/text1 exch store
/boundingBox exch store
/padding
/boundingBox load 3 get
/text1 load textheight
/text2 load textheight
add
sub
3 div
store
/boundingBox load 0 get
/boundingBox load 1 get
/padding load 2 mul
/text2 load textheight
add add
moveto
/text1 load
show
/boundingBox load 0 get
/boundingBox load 1 get
/padding load
add
moveto
/text2 load
show
end
/FontSize load setfontsize
} bind def
/rpField3Line
{
/FontSize3Line load setfontsize
<<
/boundingBox []
/text1 ()
/text2 ()
/text3 ()
/padding 0
>> begin
/text3 exch store
/text2 exch store
/text1 exch store
/boundingBox exch store
/padding
/boundingBox load 3 get
/text1 load textheight
/text2 load textheight
/text3 load textheight
add add
sub
4 div
store
/boundingBox load 0 get
/boundingBox load 1 get
/padding load 3 mul
/text3 load textheight
/text2 load textheight
add add add
moveto
/text1 load
show
/boundingBox load 0 get
/boundingBox load 1 get
/padding load 2 mul
/text3 load textheight
add add
moveto
/text2 load
show
/boundingBox load 0 get
/boundingBox load 1 get
/padding load
add
moveto
/text3 load
show
end
/FontSize load setfontsize
} bind def
/RpFields load
{
<<
/boundingBox []
/autIdemPos []
/text ()
/autIdem false
>> begin
dup
(Field) exch concat cvn load
/boundingBox exch store
dup
(PosAutIdem) exch concat cvn load
/autIdemPos exch store
dup
cvn load
/text exch store
dup
(AutIdem) concat cvn load
/autIdem exch store
/text load type
/stringtype eq
{ % text is string
/boundingBox load
/text load
rpField1Line
}
{ % text is not string
/text load type
/arraytype eq
{ % text is array
/text load length
dup
1 eq { % length is 1
/boundingBox load
/text loadarr
rpField1Line
} if
dup
2 eq { % length is 2
/boundingBox load
/text loadarr
rpField2Line
} if
dup
3 eq { % length is 3
/boundingBox load
/text loadarr
rpField3Line
} if
pop
}
{ % text is not array
/text load
false eq {
/boundingBox load
(* * * * *)
rpField1Line
} if
} ifelse
} ifelse
/autIdem load not
{
/autIdemPos loadarr
moveto
(x) show
} if
end
} forall
showpage

BIN
rosa.pdf Normal file

Binary file not shown.

BIN
rosa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB