File: form.ps

package info (click to toggle)
libpostscriptbarcode 20140312-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 1,768 kB
  • ctags: 65
  • sloc: perl: 192; makefile: 180; sh: 107; lisp: 92; java: 49
file content (67 lines) | stat: -rw-r--r-- 1,663 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% this code could be appended to the barcode.ps

/line 		512 string def % for input line buffering

/getfield { % cut the line with separator
  /separator exch def
  /original  exch def
  original separator search
  { exch pop }
  { () original } ifelse %  give back the field before separator and the part after it
} bind def

  
/printform { % printing  page with the sent variables
  /qty exch def
  /stockcode exch def
  /palette exch def

  % you can customize this as you need
  20 350 500 350 rectstroke

  /Helvetica findfont 10 scalefont setfont
  
  gsave
  50 550 translate
  palette code39 barcode
  grestore

  gsave
  50 540 moveto (Palette:   ) show palette show
  50 520 moveto (StockCode: ) show stockcode show
  50 500 moveto (Qty:       ) show qty show
  grestore
	  
  showpage
} bind def


/parseline { % bind string in line to variables
  %palette;stockcode;qty

  line 
    (;) getfield /palette exch def
    (;) getfield /stockcode exch def
    (;) getfield /qty exch def
  pop % remove the tempstring

  palette stockcode qty printform % print the form with values from line
} bind def


% read the lines
/parsefile {
  line readline  % read a line from the file
  {   % 'while' procedure body
    parseline % parse the line 
    currentfile cvlit % use as operand
    line readline % and read the next line
    not {exit} if % exit if no more input to be had
  } loop   % end of while-proc
} bind def   % /printfile

currentfile cvlit % uses rest of this file as input

% everything following 'parseFile' is treated as data, through EOF
%palette;stockcode;qty
parsefile