rghost 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +101 -0
- data/README.txt +3 -0
- data/Rakefile +93 -0
- data/lib/rghost.rb +3 -0
- data/lib/rghost/arc.rb +39 -0
- data/lib/rghost/barcode.rb +40 -0
- data/lib/rghost/callback.rb +55 -0
- data/lib/rghost/color.rb +118 -0
- data/lib/rghost/constants.rb +616 -0
- data/lib/rghost/convert.rb +24 -0
- data/lib/rghost/cursor.rb +82 -0
- data/lib/rghost/data_grid/basic_grid.rb +136 -0
- data/lib/rghost/data_grid/csv_grid.rb +27 -0
- data/lib/rghost/data_grid/data_grid.rb +14 -0
- data/lib/rghost/data_grid/dynamic_callback.rb +12 -0
- data/lib/rghost/data_grid/field_format.rb +60 -0
- data/lib/rghost/data_grid/grid.rb +18 -0
- data/lib/rghost/data_grid/header.rb +111 -0
- data/lib/rghost/data_grid/rails_grid.rb +37 -0
- data/lib/rghost/data_grid/static_callback.rb +13 -0
- data/lib/rghost/data_grid/style/border_lines.rb +47 -0
- data/lib/rghost/data_grid/style/bottom_lines.rb +30 -0
- data/lib/rghost/data_grid/style/old_forms.rb +30 -0
- data/lib/rghost/data_grid/style/style.rb +8 -0
- data/lib/rghost/document.rb +380 -0
- data/lib/rghost/dsc_entry.rb +20 -0
- data/lib/rghost/dynamic_document_callback.rb +27 -0
- data/lib/rghost/eps.rb +22 -0
- data/lib/rghost/font.rb +52 -0
- data/lib/rghost/function.rb +36 -0
- data/lib/rghost/gif.rb +28 -0
- data/lib/rghost/graphic.rb +28 -0
- data/lib/rghost/gs_alone.rb +17 -0
- data/lib/rghost/helpers.rb +13 -0
- data/lib/rghost/horizontal_line.rb +29 -0
- data/lib/rghost/image.rb +26 -0
- data/lib/rghost/jpeg.rb +26 -0
- data/lib/rghost/line.rb +40 -0
- data/lib/rghost/line_width.rb +17 -0
- data/lib/rghost/load.rb +37 -0
- data/lib/rghost/newpath.rb +20 -0
- data/lib/rghost/paper.rb +88 -0
- data/lib/rghost/point.rb +22 -0
- data/lib/rghost/point_with_command.rb +17 -0
- data/lib/rghost/ps/basic.ps +14 -0
- data/lib/rghost/ps/begin_document.ps +7 -0
- data/lib/rghost/ps/callbacks.ps +146 -0
- data/lib/rghost/ps/code128.font +344 -0
- data/lib/rghost/ps/code39.font +195 -0
- data/lib/rghost/ps/cursor.ps +41 -0
- data/lib/rghost/ps/datagrid.ps +52 -0
- data/lib/rghost/ps/ean.font +150 -0
- data/lib/rghost/ps/eps.ps +42 -0
- data/lib/rghost/ps/font.ps +31 -0
- data/lib/rghost/ps/functions.ps +646 -0
- data/lib/rghost/ps/gif.ps +150 -0
- data/lib/rghost/ps/horizontal_line.ps +3 -0
- data/lib/rghost/ps/i25.font +103 -0
- data/lib/rghost/ps/jpeg.ps +122 -0
- data/lib/rghost/ps/paper.ps +8 -0
- data/lib/rghost/ps/rectangle.ps +5 -0
- data/lib/rghost/ps/row.ps +4 -0
- data/lib/rghost/ps/show.ps +20 -0
- data/lib/rghost/ps/table_callbacks.ps +96 -0
- data/lib/rghost/ps/textarea.ps +11 -0
- data/lib/rghost/ps/type.ps +1 -0
- data/lib/rghost/ps/unit.ps +3 -0
- data/lib/rghost/ps/vertical_line.ps +14 -0
- data/lib/rghost/ps_object.rb +51 -0
- data/lib/rghost/rectangle.rb +39 -0
- data/lib/rghost/rgengine.so +0 -0
- data/lib/rghost/rghost.rb +3 -0
- data/lib/rghost/ruby_ghost_config.rb +25 -0
- data/lib/rghost/ruby_ghost_engine.rb +175 -0
- data/lib/rghost/ruby_to_ps.rb +92 -0
- data/lib/rghost/scale.rb +14 -0
- data/lib/rghost/show.rb +31 -0
- data/lib/rghost/static_document_callback.rb +22 -0
- data/lib/rghost/text_in.rb +29 -0
- data/lib/rghost/textarea.rb +115 -0
- data/lib/rghost/units.rb +81 -0
- data/lib/rghost/variable.rb +12 -0
- data/lib/rghost/version.rb +9 -0
- data/lib/rghost/vertical_line.rb +29 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/test/test_helper.rb +2 -0
- data/test/test_rghost.rb +11 -0
- data/website/index.html +11 -0
- data/website/index.txt +30 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +129 -0
- data/website/template.rhtml +48 -0
- metadata +145 -0
@@ -0,0 +1,150 @@
|
|
1
|
+
% Copyright (C) 1989, 1992, 1993, 1998 Aladdin Enterprises. All rights reserved.
|
2
|
+
% For more information about licensing, please refer to
|
3
|
+
% http://www.ghostscript.com/licensing/. For information on
|
4
|
+
% commercial licensing, go to http://www.artifex.com/licensing/ or
|
5
|
+
% Adaptation to ruby-ghost by Shairon Toledo shairon.toledo@gmail.com
|
6
|
+
|
7
|
+
/read1 % <file> read1 <int>
|
8
|
+
{ read pop
|
9
|
+
} bind def
|
10
|
+
/read2 % <file> read2 <int>
|
11
|
+
{ dup read1 exch read1 8 bitshift add
|
12
|
+
} bind def
|
13
|
+
|
14
|
+
/readGIFheader % <file> readGIFheader <dict>
|
15
|
+
{ 20 dict begin
|
16
|
+
dup 6 string readstring pop
|
17
|
+
dup (GIF87a) eq exch (GIF89a) eq or not
|
18
|
+
{ (Not a GIF file.\n) print cleartomark stop
|
19
|
+
} if
|
20
|
+
dup read2 /Width exch def
|
21
|
+
dup read2 /Height exch def
|
22
|
+
dup read1
|
23
|
+
dup 128 ge /GlobalColor exch def
|
24
|
+
dup -4 bitshift 7 and 1 add /BitsPerPixel exch def %***BOGUS?***
|
25
|
+
dup 8 and 0 ne /PaletteSorted exch def
|
26
|
+
7 and 1 add dup /BitsPerPixel exch def
|
27
|
+
1 exch bitshift /PaletteSize exch def
|
28
|
+
dup read1 /BackgroundIndex exch def
|
29
|
+
dup read1 15 add 64 div /AspectRatio exch def
|
30
|
+
GlobalColor
|
31
|
+
{ PaletteSize 3 mul string readstring pop
|
32
|
+
/GlobalPalette exch def
|
33
|
+
} if
|
34
|
+
currentdict end
|
35
|
+
} bind def
|
36
|
+
|
37
|
+
/readGIFimageHeader % <file> readGIFimageHeader <dict>
|
38
|
+
% Note: GIF header must be on dict stack
|
39
|
+
{ 10 dict begin
|
40
|
+
{ dup read1
|
41
|
+
dup (!) 0 get ne { exit } if pop % extension
|
42
|
+
dup read1 pop
|
43
|
+
{ dup read1 dup 0 eq { pop exit } if { dup read1 pop } repeat
|
44
|
+
} loop
|
45
|
+
} loop
|
46
|
+
(,) 0 get ne
|
47
|
+
{ (Not a GIF image.\n) print stop
|
48
|
+
} if
|
49
|
+
dup read2 /Left exch def
|
50
|
+
dup read2 /Top exch def
|
51
|
+
dup read2 /Width exch def
|
52
|
+
dup read2 /Height exch def
|
53
|
+
dup read1
|
54
|
+
dup 128 ge /LocalColor exch def
|
55
|
+
dup 64 and 0 ne /Interlaced exch def
|
56
|
+
LocalColor
|
57
|
+
{ 7 and 1 add /BitsPerPixel exch def
|
58
|
+
1 BitsPerPixel bitshift 3 mul string readstring pop
|
59
|
+
/Palette exch def
|
60
|
+
}
|
61
|
+
{ pop pop /Palette GlobalPalette def
|
62
|
+
}
|
63
|
+
ifelse
|
64
|
+
currentdict end
|
65
|
+
} bind def
|
66
|
+
|
67
|
+
/imageGIF % <imagedict> imageGIF
|
68
|
+
{ /ImageOut where
|
69
|
+
{ pop
|
70
|
+
% We know BitsPerComponent = 8, Decode = [0 255].
|
71
|
+
% and there is only a single data source which is
|
72
|
+
% either a filter or a string whose size is exactly
|
73
|
+
% the width of the row.
|
74
|
+
dup /DataSource get dup type /stringtype eq
|
75
|
+
{ ImageOut exch writestring
|
76
|
+
}
|
77
|
+
{ pop dup /Width get string
|
78
|
+
1 index /Height get
|
79
|
+
{ 1 index /DataSource get 1 index readstring pop
|
80
|
+
ImageOut exch writestring
|
81
|
+
}
|
82
|
+
repeat pop pop
|
83
|
+
}
|
84
|
+
ifelse
|
85
|
+
}
|
86
|
+
{ image
|
87
|
+
}
|
88
|
+
ifelse
|
89
|
+
} bind def
|
90
|
+
|
91
|
+
/viewGIF % <file|string> viewGIF -
|
92
|
+
{ save 20 dict begin
|
93
|
+
/saved exch def
|
94
|
+
dup type /stringtype eq { (r) file } if
|
95
|
+
/F exch def
|
96
|
+
/ImageOutFile where { /ImageOut ImageOutFile (w) file def } if
|
97
|
+
F readGIFheader /Header exch def
|
98
|
+
currentdict Header end begin begin
|
99
|
+
VGIFDEBUG { Header { exch == == } forall (----------------\n) print flush } if
|
100
|
+
F readGIFimageHeader /ImageHeader exch def
|
101
|
+
currentdict ImageHeader end begin begin
|
102
|
+
VGIFDEBUG { ImageHeader { exch == == } forall (----------------\n) print flush } if
|
103
|
+
/D F
|
104
|
+
<< /InitialCodeLength F read1
|
105
|
+
/FirstBitLowOrder true
|
106
|
+
/BlockData true
|
107
|
+
/EarlyChange 0
|
108
|
+
>> /LZWDecode filter def
|
109
|
+
|
110
|
+
[/Indexed /DeviceRGB 1 BitsPerPixel bitshift 1 sub Palette] setcolorspace
|
111
|
+
matrix currentmatrix
|
112
|
+
0 1 3 { 2 copy get dup 0 ne { dup abs div } if 3 copy put pop pop } for
|
113
|
+
setmatrix
|
114
|
+
|
115
|
+
<< /ImageType 1
|
116
|
+
/ImageMatrix [1 0 0 -1 0 Height]
|
117
|
+
/BitsPerComponent 8
|
118
|
+
/Decode [0 255]
|
119
|
+
Interlaced
|
120
|
+
{ /Width Width /Height 1
|
121
|
+
/row Width string def
|
122
|
+
/DataSource row
|
123
|
+
>> /I exch def
|
124
|
+
/inter % <num> <denom> inter -
|
125
|
+
{ /denom exch def /num exch def
|
126
|
+
gsave
|
127
|
+
/lines Height denom 1 sub add num sub denom idiv def
|
128
|
+
0 1 lines 1 sub {
|
129
|
+
Height exch denom mul num add sub
|
130
|
+
I /ImageMatrix get 5 3 -1 roll put
|
131
|
+
D row readstring pop pop
|
132
|
+
I imageGIF
|
133
|
+
} for
|
134
|
+
grestore
|
135
|
+
}
|
136
|
+
bind def
|
137
|
+
0 8 inter
|
138
|
+
4 8 inter
|
139
|
+
2 4 inter
|
140
|
+
1 2 inter
|
141
|
+
}
|
142
|
+
{ /Width Width /Height Height
|
143
|
+
gif_params
|
144
|
+
/DataSource D
|
145
|
+
>> imageGIF
|
146
|
+
}
|
147
|
+
ifelse
|
148
|
+
saved end end end restore
|
149
|
+
} bind def
|
150
|
+
gsave
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/horizontal_line_top { exch gsave current_row row_height add moveto 0 rlineto stroke grestore } def
|
2
|
+
/horizontal_line_middle { exch gsave current_row row_height sqrt add moveto 0 rlineto stroke grestore }def
|
3
|
+
/horizontal_line_bottom { exch gsave current_row row_padding sub moveto 0 rlineto stroke grestore }def
|
@@ -0,0 +1,103 @@
|
|
1
|
+
%!PS-AdobeFont-1.0: Codei25JK 1.000
|
2
|
+
%%CreationDate: Thu Feb 22 12:20:33 2001
|
3
|
+
%%VMusage: 10488 6784
|
4
|
+
%
|
5
|
+
% This Type 1 PostScript font implements the Code 39 bar code.
|
6
|
+
% Copyright (C) 2001 Jan Karrman. All rights reserved.
|
7
|
+
%
|
8
|
+
% This program is free software; you can redistribute it and/or modify
|
9
|
+
% it under the terms of the GNU General Public License as published by
|
10
|
+
% the Free Software Foundation; either version 2 of the License, or
|
11
|
+
% (at your option) any later version.
|
12
|
+
%
|
13
|
+
% This program is distributed in the hope that it will be useful,
|
14
|
+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
% GNU General Public License for more details.
|
17
|
+
%
|
18
|
+
% You should have received a copy of the GNU General Public License
|
19
|
+
% along with this program; if not, write to the Free Software
|
20
|
+
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
21
|
+
%
|
22
|
+
false
|
23
|
+
17 dict begin
|
24
|
+
/FontInfo 13 dict dup begin
|
25
|
+
/version(001.000) readonly def
|
26
|
+
/Notice(Copyright (C) 2001 Jan Karrman. All rights reserved.)readonly def
|
27
|
+
/FullName(Interleaved 2 of 5)readonly def
|
28
|
+
/FamilyName(Interleaved 2 of 5)readonly def
|
29
|
+
/Weight(Normal)readonly def
|
30
|
+
/isFixedPitch false def
|
31
|
+
/ItalicAngle 0 def
|
32
|
+
/UnderlinePosition -133 def
|
33
|
+
/UnderlineThickness 20 def
|
34
|
+
end readonly def
|
35
|
+
/FontName /Codei25JK def
|
36
|
+
/Encoding StandardEncoding def
|
37
|
+
/PaintType 0 def
|
38
|
+
/FontType 1 def
|
39
|
+
/StrokeWidth 0 def
|
40
|
+
/FontMatrix[0.001 0 0 0.001 0 0]readonly def
|
41
|
+
/UniqueID 4345031 def
|
42
|
+
/FontBBox{0 0 201 1003}readonly def
|
43
|
+
currentdict end
|
44
|
+
currentfile eexec
|
45
|
+
d9d66f633b846a97b686a97e45a3d0aa0525392eecac163e584a9104d99ad0bc
|
46
|
+
1b1f3f7121d1d0f2c60dd206b0d3c8c450620b47320ca0aeb8937511e456aade
|
47
|
+
8e66b301b1e3e9dfe17e2f79ecfea709ff3dae19b4c169df6773eda414d02915
|
48
|
+
a6f0faf8b24fbb0777c697be8a37d63a390ad9dae495bb7e626721ff2fd3fb14
|
49
|
+
7c80d22beac37c2624d818d58c8df0209f5ce76acdde57a303d9042bf0a674d0
|
50
|
+
95697f925f532d1814bea8f8a5b1fd0737f362c88e00acaed0fbd4a36e9c2a30
|
51
|
+
8f53570cf2a0c2f3cacdcef9a65bc833ba02199166a964e544f4b7b7afeaac17
|
52
|
+
f8e05601552604b40d45d9fa0ab5a091879bf8f22cfa7ada67b9cc14129ca45f
|
53
|
+
a4c800e5c096889016e179a61c27f4e94f4f665fe0ffde7fa87eee002851e3da
|
54
|
+
feb5b00e066377ebe43637036e54a7a96bffe3a5b9bb29d1139125a36291f767
|
55
|
+
17d0083283a430a2842be99904f3160181d8007d412200a34824f478a098157d
|
56
|
+
96002e8dea100b6b11ed62564d1084f84db72cf8246e1afc90613b4fc4857601
|
57
|
+
a5dbf84543531f6c6b5d0843fb6f982f1a942c7fc9d041b3a1678d40e94f994c
|
58
|
+
a2f2f27034fa69106f1adaa2dac46114af354e3143e0edd091a021eee4060880
|
59
|
+
0bc8f236114a0a40eb6533819e15d3e4f2adacdb65329de3f7f57bc58432c12d
|
60
|
+
3ffe9847c0797728c4d0dc106609cbcb7ec1df50872bede40f92c33b7ed57aa8
|
61
|
+
05d58482571f8440d26d1e27d9b63bafa6d5d3a506238448dd4832d73d1ad4e1
|
62
|
+
0656d6796a70de97442bc98689d002beb5a63e222bc8f3000d25873be21fd28c
|
63
|
+
ddb4dfc11da7337bfbdb28714f5905c98798499a36e9bada0cdf82aefbbb9b7f
|
64
|
+
88f5f0b5cd27b129da62afba21cc46bb3207676b96695aedbfe52b3d4e097418
|
65
|
+
c1033dd020930229eb0888b285b72c0ef088a386cb77a060b529ff519061d665
|
66
|
+
3e8df6c9c90f4c459352f8149cf30339daa54822c2d72a7938a76fe4bdd1becb
|
67
|
+
4f085845d39491f9ac0256d2ea56c62cd14a0b49dedfa9b1da56c771eb30f6f3
|
68
|
+
b26e479da0bbc92521b15ad68cad72849d651245c5ec4f62a6e5bf9897e75c31
|
69
|
+
a1a6938f1bbf331d5432ba5eca376fd94ca1d82701e2f30aa14cef5c7609b7b8
|
70
|
+
a5e1854cad98aa1eb4e769f964ba42ad48748fb6356a4f1b01317b3f7882b2a3
|
71
|
+
69c6301f483dcf59ebcfcc2bd9d6fd09448d01ed1d5303950c46968954828189
|
72
|
+
c1955f876e92acaff10ecd920b11bf0f1f75006e66fe5ff817f94ab879d80e76
|
73
|
+
ff1cf788da1298bfb31b43aa1eb02b4ead48691c2a47df0576970140ceec8429
|
74
|
+
a1acd7e32b7bbc152d967e4fd41cdd60d6643a6584fba4114608c6556b42a230
|
75
|
+
7eedeaede6918d32153c448db337d539fcb0edd42cd26374e816bf38a498c651
|
76
|
+
9e2dcf1de36ca654aa4124d577d7f47fd14be17d8c830a2bcafb0ccdfbe13d2e
|
77
|
+
7c026ee679c3e7adab9939315238f16f7ba5a0de9a8171295c0deaa2bad1fb80
|
78
|
+
d67f16b316cbb54d5da2b380bffaaff1d0bb3d19d19f2dab4becb387548d6d13
|
79
|
+
326ed54154eb4040e6e7e797e18a75e5ac29d39a35490f03daf5a2da077f6f9d
|
80
|
+
588054a06a923ebd689ff14fe3bbe917e4621145d1ddda773ec146cb259e4e72
|
81
|
+
235d21f4b7d7fec81f27ff764f80221ce57d5b447026590da0fbd0ccba3a850e
|
82
|
+
e76b6d6214ac21b1012afab0fd82aaf86bf0fbef01d92c7862418323581e7a6c
|
83
|
+
96fe2ed6c5cc6aa7ee629d85ab55a9517579b847f0173eae4b5ebb54d5118af0
|
84
|
+
9cde391674cc9ced53988dfa7c609e2eda8a7988c135c4aa9e6a41be39a192b8
|
85
|
+
d5701ce678af5d99ad1e63d6cc276c10deb077e464bf8b8105b2c55f2ee5dbd1
|
86
|
+
fd75d518841b85833cef602275d860
|
87
|
+
00000000000000000000000000000000
|
88
|
+
00000000000000000000000000000000
|
89
|
+
00000000000000000000000000000000
|
90
|
+
00000000000000000000000000000000
|
91
|
+
00000000000000000000000000000000
|
92
|
+
00000000000000000000000000000000
|
93
|
+
00000000000000000000000000000000
|
94
|
+
00000000000000000000000000000000
|
95
|
+
00000000000000000000000000000000
|
96
|
+
00000000000000000000000000000000
|
97
|
+
00000000000000000000000000000000
|
98
|
+
00000000000000000000000000000000
|
99
|
+
00000000000000000000000000000000
|
100
|
+
00000000000000000000000000000000
|
101
|
+
00000000000000000000000000000000
|
102
|
+
00000000000000000000000000000000
|
103
|
+
cleartomark{restore}if
|
@@ -0,0 +1,122 @@
|
|
1
|
+
% viewjpeg.ps Copyright (C) 1994 Thomas Merz <tm@pdflib.com>
|
2
|
+
% This software is provided AS-IS with no warranty, either express or
|
3
|
+
% implied.
|
4
|
+
% For more information about licensing, please refer to http://www.ghostscript.com/licensing/
|
5
|
+
% Author's address:
|
6
|
+
% ------------------------------+
|
7
|
+
% {(pstack exec quit) = flush } | Thomas Merz, Munich
|
8
|
+
% pstack exec quit | voice +49/89/29160728
|
9
|
+
% ------------------------------+ tm@muc.de http://www.muc.de/~tm/
|
10
|
+
%
|
11
|
+
% Adaptation to ruby-ghost by Shairon Toledo shairon.toledo@gmail.com
|
12
|
+
% zoom, translate and real size
|
13
|
+
|
14
|
+
/languagelevel where {pop languagelevel 2 lt}{true} ifelse {
|
15
|
+
(JPEG needs PostScript Level 2!\n) print flush stop
|
16
|
+
} if
|
17
|
+
|
18
|
+
/JPEGdict 20 dict def
|
19
|
+
JPEGdict begin
|
20
|
+
|
21
|
+
/NoParamMarkers [ % JPEG markers without additional parameters
|
22
|
+
16#D0 16#D1 16#D2 16#D3 16#D4 16#D5 16#D6 16#D7 16#D8 16#01
|
23
|
+
] def
|
24
|
+
|
25
|
+
/NotSupportedMarkers [ % JPEG markers not supported by PostScript level 2
|
26
|
+
16#C3 16#C5 16#C6 16#C7 16#C8 16#C9 16#CA 16#CB 16#CD 16#CE 16#CF
|
27
|
+
] def
|
28
|
+
|
29
|
+
% Names of color spaces
|
30
|
+
/ColorSpaceNames << /1 /DeviceGray /3 /DeviceRGB /4 /DeviceCMYK >> def
|
31
|
+
|
32
|
+
% read one byte from file F
|
33
|
+
% - ==> int --or-- stop context
|
34
|
+
/NextByte {
|
35
|
+
F read not { (Read error in ViewJPEG!\n) print flush stop } if
|
36
|
+
} bind def
|
37
|
+
|
38
|
+
/SkipSegment { % read two bytes and skip that much data
|
39
|
+
NextByte 8 bitshift NextByte add 2 sub { NextByte pop } repeat
|
40
|
+
} bind def
|
41
|
+
|
42
|
+
% read width, height, and # of components from JPEG markers
|
43
|
+
% and store in dict
|
44
|
+
/readJPEGmarkers { % - ==> dict --or-- stop context
|
45
|
+
5 dict begin
|
46
|
+
|
47
|
+
{ % loop: read JPEG marker segments until we find SOFn marker or EOF
|
48
|
+
NextByte
|
49
|
+
16#FF eq { % found marker
|
50
|
+
/markertype NextByte def
|
51
|
+
% Is it S0F0=baseline, SOF1=extended sequential, SOF2=progressive ?
|
52
|
+
markertype dup 16#C0 ge exch 16#C2 le and {
|
53
|
+
NextByte pop NextByte pop % segment length
|
54
|
+
% Ghostscript and Adobe PS accept only data precision 8
|
55
|
+
NextByte 8 ne {
|
56
|
+
(Error: not 8 bits per component!\n) print flush stop
|
57
|
+
} if
|
58
|
+
|
59
|
+
% Read crucial image parameters
|
60
|
+
/height NextByte 8 bitshift NextByte add def
|
61
|
+
/width NextByte 8 bitshift NextByte add def
|
62
|
+
/colors NextByte def
|
63
|
+
|
64
|
+
VJPGDEBUG { currentdict { exch == == } forall flush } if
|
65
|
+
exit
|
66
|
+
} if
|
67
|
+
|
68
|
+
% detect several segment types which are not compatible with PS
|
69
|
+
NotSupportedMarkers {
|
70
|
+
markertype eq {
|
71
|
+
(Marker ) print markertype ==
|
72
|
+
(not supported!\n) print flush stop
|
73
|
+
} if
|
74
|
+
} forall
|
75
|
+
|
76
|
+
% Skip segment if marker has parameters associated with it
|
77
|
+
true NoParamMarkers { markertype eq {pop false exit} if } forall
|
78
|
+
{ SkipSegment } if
|
79
|
+
} if
|
80
|
+
} loop
|
81
|
+
|
82
|
+
currentdict dup /markertype undef
|
83
|
+
end
|
84
|
+
} bind def
|
85
|
+
|
86
|
+
end % JPEGdict
|
87
|
+
|
88
|
+
% read image parameters from JPEG file and display the image
|
89
|
+
/viewJPEG { % <file|string> ==> -
|
90
|
+
|
91
|
+
save
|
92
|
+
JPEGdict begin
|
93
|
+
/saved exch def
|
94
|
+
/scratch 1 string def
|
95
|
+
dup type /stringtype eq { (r) file } if
|
96
|
+
/F exch def
|
97
|
+
|
98
|
+
readJPEGmarkers begin
|
99
|
+
F 0 setfileposition % reset file pointer
|
100
|
+
width zoom mul height zoom mul scale
|
101
|
+
|
102
|
+
% use whole width or height, whichever is appropriate
|
103
|
+
ColorSpaceNames colors scratch cvs get setcolorspace
|
104
|
+
|
105
|
+
% prepare image dictionary
|
106
|
+
<< /ImageType 1
|
107
|
+
/Width width
|
108
|
+
/Height height
|
109
|
+
/ImageMatrix [ width 0 0 height neg 0 height ]
|
110
|
+
/BitsPerComponent 8
|
111
|
+
% If 4-component (CMYK), assume data is inverted per Adobe Photoshop
|
112
|
+
colors 4 eq {
|
113
|
+
/Decode [ colors { 1 0 } repeat ]
|
114
|
+
} {
|
115
|
+
/Decode [ colors { 0 1 } repeat ]
|
116
|
+
} ifelse
|
117
|
+
/DataSource F /DCTDecode filter
|
118
|
+
>> image
|
119
|
+
end % image parameter dictionary
|
120
|
+
saved end restore
|
121
|
+
} bind def
|
122
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
2 dict dup /PageSize pagesize put dup /ImagingBBox null put setpagedevice
|
2
|
+
/limit_top { pagesize 1 get margin /top get sub } def
|
3
|
+
/limit_right { pagesize 0 get margin /right get sub } def
|
4
|
+
/limit_bottom { margin /bottom get } def
|
5
|
+
/limit_left { margin /left get } def
|
6
|
+
/area_x pagesize 0 get margin /right get sub margin /left get sub def
|
7
|
+
/area_y pagesize 1 get margin /top get sub margin /bottom get sub def
|
8
|
+
1 unit 1 unit moveto
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/show_center{ dup stringwidth pop 2 div neg 0 rmoveto show } def
|
2
|
+
/show_right{ dup stringwidth pop neg 0 rmoveto show } def
|
3
|
+
/show_left{ show }def
|
4
|
+
|
5
|
+
%%TODO: page_(center & left & right)
|
6
|
+
|
7
|
+
/page_center{
|
8
|
+
area_x 2 div margin /left get add current_row moveto
|
9
|
+
dup stringwidth pop 2 div neg 0 rmoveto show
|
10
|
+
} def
|
11
|
+
|
12
|
+
/page_right{
|
13
|
+
area_x margin /left get add current_row moveto
|
14
|
+
dup stringwidth pop neg 0 rmoveto show
|
15
|
+
} def
|
16
|
+
|
17
|
+
/page_left{
|
18
|
+
limit_left current_row moveto
|
19
|
+
dup stringwidth pop neg 0 rmoveto show
|
20
|
+
} def
|
@@ -0,0 +1,96 @@
|
|
1
|
+
%%TABLE
|
2
|
+
/before_table_create {} def
|
3
|
+
/after_table_create{} def
|
4
|
+
%%%%%%TABLE ROW---------------------
|
5
|
+
|
6
|
+
/row_odd_or_even {
|
7
|
+
current_table_row odd? {odd_row}{even_row} ifelse
|
8
|
+
}def
|
9
|
+
/before_row_create 3 dict def before_row_create begin
|
10
|
+
/proc { } bind def
|
11
|
+
/except [ ] def
|
12
|
+
/only [ ] def
|
13
|
+
end
|
14
|
+
|
15
|
+
/odd_row 3 dict def odd_row begin
|
16
|
+
/proc { } bind def
|
17
|
+
/except [ ] def
|
18
|
+
/only [ ] def
|
19
|
+
end
|
20
|
+
|
21
|
+
/even_row 3 dict def even_row begin
|
22
|
+
/proc { } bind def
|
23
|
+
/except [ ] def
|
24
|
+
/only [ ] def
|
25
|
+
end
|
26
|
+
|
27
|
+
%column
|
28
|
+
/col_odd_or_even {
|
29
|
+
col odd? {odd_column}{even_column} ifelse
|
30
|
+
}def
|
31
|
+
|
32
|
+
/before_column 3 dict def before_column begin
|
33
|
+
/proc { } bind def
|
34
|
+
/except [ ] def
|
35
|
+
/only [ ] def
|
36
|
+
end
|
37
|
+
|
38
|
+
/after_column 3 dict def after_column begin
|
39
|
+
/proc { } bind def
|
40
|
+
/except [ ] def
|
41
|
+
/only [ ] def
|
42
|
+
end
|
43
|
+
|
44
|
+
/odd_column 3 dict def odd_column begin
|
45
|
+
/proc { } bind def
|
46
|
+
/except [ ] def
|
47
|
+
/only [ ] def
|
48
|
+
end
|
49
|
+
|
50
|
+
/even_column 3 dict def even_column begin
|
51
|
+
/proc { } bind def
|
52
|
+
/except [ ] def
|
53
|
+
/only [ ] def
|
54
|
+
end
|
55
|
+
|
56
|
+
%%HEADER----------------------
|
57
|
+
/before_header_create {} def
|
58
|
+
/after_header_create {} def
|
59
|
+
|
60
|
+
/before_column_header 3 dict def before_column_header begin
|
61
|
+
/proc { } bind def
|
62
|
+
/except [ ] def
|
63
|
+
/only [ ] def
|
64
|
+
end
|
65
|
+
|
66
|
+
/after_column_header 3 dict def after_column_header begin
|
67
|
+
/proc { } bind def
|
68
|
+
/except [ ] def
|
69
|
+
/only [ ] def
|
70
|
+
end
|
71
|
+
|
72
|
+
%%ROW CALLBACKS
|
73
|
+
/callback_row{
|
74
|
+
dup dup
|
75
|
+
/except get length 0 ne { /except get current_table_row include? not}{
|
76
|
+
dup /only get length 0 ne { /only get current_table_row include?}{
|
77
|
+
pop true
|
78
|
+
}ifelse
|
79
|
+
}ifelse
|
80
|
+
{ /proc get exec }{
|
81
|
+
pop
|
82
|
+
}ifelse
|
83
|
+
} bind def
|
84
|
+
|
85
|
+
%%COLUMN CALLBACKS
|
86
|
+
/callback_col{
|
87
|
+
dup dup
|
88
|
+
/except get length 0 ne { /except get col include? not}{
|
89
|
+
dup /only get length 0 ne { /only get col include?}{
|
90
|
+
pop true
|
91
|
+
}ifelse
|
92
|
+
}ifelse
|
93
|
+
{ /proc get exec }{
|
94
|
+
pop
|
95
|
+
}ifelse
|
96
|
+
} bind def
|