% Copyright (C) 2001-2019 Artifex Software, Inc. % All Rights Reserved. % % This software is provided AS-IS with no warranty, either express or % implied. % % This software is distributed under license and may not be copied, % modified or distributed except as expressly authorized under the terms % of the license contained in the file LICENSE in this distribution. % % Refer to licensing information at http://www.artifex.com or contact % Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, % CA 94945, U.S.A., +1(415)492-9861, for further information. % % Convert an arbitrary PostScript file to an EPSI file. % % Please do not contact these users if you have questions. They no longer % have the time, interest, or current expertise to keep this code working. % If you find bugs, please send proposed fixes to bug-gs@ghostscript.com. % % Bug fix 2002-04-20 by rayjj: Bounding box was incorrect since it depended % on the dither pattern and gray shade at the boundary. Changed to use % 8-bit grayscale preview image to allow correct bounding box (at the % expense of a 8x larger preview image). Also moved .setsafe until after % the device and file operations are complete (but still before the input % file is processed. % Bug fix 2000-04-11 by lpd: if a font didn't have a FontName (which is the % case for bitmap fonts produced by recent versions of dvips), setfont % caused an error. % Bug fix 8/21/99 by lpd: many of the margin and width computations were % wrong (off by 1). The code only "worked" because the bugs were % (mostly) in conservative directions. % Modified 3/17/98 by lpd to make it possible to run this file without % running the ps2epsi script first, for debugging. % Bug fix 9/29/97 by lpd <ghost@aladdin.com>: if the page size wasn't an % exact multiple of 8 bits, an incorrect bounding box (or a rangecheck % error) could occur. % Patched 7/26/95 by % Greg P. Kochanski <gpk@bell-labs.com> % to add many new DSC comments and make the comments conforming. % Original version contributed by % George Cameron <george@bio-medical-physics.aberdeen.ac.uk> % % Initialize, and redefine copypage and showpage. % ps2edict is normally defined in the pre-loaded code created by the % ps2epsi script. /ps2edict where { pop } { /ps2edict 25 dict def } ifelse ps2edict begin % The main procedure /ps2epsi { % bbox written to outfile by bbox device from ps2epsi command file outfile (r) file /epsifile exch def /BBoxString epsifile 256 string readline pop def /HiresBBoxString epsifile 256 string readline pop def epsifile closefile % Open the file outfile (w) file /epsifile exch def % Get the device parameters currentdevice getdeviceprops .dicttomark /HWSize get aload pop /devheight exch def /devwidth exch def matrix defaultmatrix /devmatrix exch def % Make a corresponding 8-bit deep memory device devmatrix devwidth devheight 256 string 0 1 255 { 1 index exch dup 255 exch sub put } for makeimagedevice /arraydevice exch def arraydevice % Turn on anti-aliasing mark /TextAlphaBits 4 /GraphicsAlphaBits 4 6 -1 roll putdeviceprops setdevice % (does an erasepage) /rowwidth devwidth def /row rowwidth string def /zerorow rowwidth string def % all zero % Replace the definition of showpage userdict /showpage { ps2edict begin epsipage end } bind put userdict /setfont { ps2edict begin epsisetfont end } bind put userdict /setpagedevice /pop load put } bind def /epsifontdict 100 dict def /epsisetfont { % code here keeps a list of font names in dictionary epsifontdict /tmpfont exch def tmpfont /FontName known { /tmpfontname tmpfont /FontName get def epsifontdict tmpfontname known not { epsifontdict tmpfontname 0 put } if epsifontdict tmpfontname 2 copy get 1 add put } if tmpfont setfont } bind def % Get a scan line from the memory device, zeroing any bits beyond % the device width. /getscanline { % <device> <y> <string> getscanline <string> dup 4 1 roll copyscanlines pop 16#ff00 devwidth 7 and neg bitshift 255 and dup 0 ne { 1 index dup length 1 sub 2 copy get 4 -1 roll and put } { pop } ifelse } bind def /margintest { % <y-start> <step> <y-limit> margintest <y-non-blank> % <y-start> <step> <y-limit> margintest - { dup arraydevice exch row getscanline zerorow ne { exit } if pop } for } bind def /epsiNameStr 200 string def /epsiNpages 0 def /epsiNpageStr 20 string def /epsipage { /epsiNpages epsiNpages 1 add def /loopcount devheight 1 sub def % Find top margin -- minimum Y of non-blank scan line. -1 0 1 loopcount margintest dup -1 eq { (blank page!!\n) print quit }{ exch pop } ifelse /tm exch def % Find bottom margin -- maximum Y of non-blank scan line. loopcount -1 0 margintest /bm exch def % Initialise limit variables /loopcount rowwidth 1 sub def /lm loopcount def /rm 0 def % Find left and right boundaries of image tm 1 bm { % Get more data arraydevice exch row getscanline pop % Scan from left to find first non-zero element % We save first the element, then the index -1 0 1 loopcount { dup row exch get 0 ne { exch pop exit }{ pop } ifelse } for % If we found -1, row is blank .. dup -1 ne { % Find the leftmost index dup lm lt % If the new index is less, we save index and element { /lm exch def } { pop } ifelse % Now find the rightmost index loopcount -1 0 { dup row exch get 0 ne { exit }{ pop } ifelse } for dup rm gt % If the new index is greater, we save index and element { /rm exch def } { pop } ifelse } { pop } ifelse } for % Write out the magic string and bounding box information epsifile (%!PS-Adobe-2.0 EPSF-1.2\n) writestring /epsititle where { pop epsifile epsititle writestring } if /epsicreator where { pop epsifile epsicreator writestring } if /epsicrdt where { pop epsifile epsicrdt writestring } if /epsifor where { pop epsifile epsifor writestring } if epsifile flushfile % Write out the page count: epsifile (%%Pages: ) writestring epsifile epsiNpages epsiNpageStr cvs writestring epsifile (\n) writestring epsifile flushfile % Write out the list of used fonts: epsifile (%%DocumentFonts:) writestring epsifontdict { epsifile ( ) writestring pop epsiNameStr cvs epsifile exch writestring } forall epsifile (\n) writestring epsifile flushfile epsifile BBoxString writestring epsifile (\n) writestring epsifile HiresBBoxString writestring epsifile (\n) writestring % Define character and bit widths for the output line buffer: /cwidth rm lm sub 1 add def /out cwidth string def epsifile (%%EndComments\n\n) writestring epsifile (%%BeginProlog\n) writestring epsifile (%%BeginPreview: ) writestring epsifile cwidth write==only epsifile ( ) writestring epsifile bm tm sub 1 add write==only epsifile ( 8 ) writestring epsifile bm tm sub 1 add cwidth 39 add 40 idiv mul write== epsifile flushfile gsave tm 1 bm { % Get a scan line interval from the array device arraydevice exch row copyscanlines lm cwidth getinterval % Write out the hex data as 40 bytes per line (82 chars) 0 40 cwidth { epsifile (% ) writestring epsifile exch 2 index exch dup cwidth exch sub 40 .min getinterval writehexstring epsifile (\n) writestring } for pop } for epsifile (%%EndImage\n) writestring epsifile (%%EndPreview\n) writestring epsifile flushfile grestore erasepage initgraphics DonePage 0 1 put } bind def (outfile) getenv { /outfile exch def ps2epsi /DonePage 1 string def (%stdin) (r) file cvx execute0 DonePage 0 get 0 eq { showpage } if } if end quit
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
PDFA_def.ps | File | 1.25 KB | 0644 |
|
PDFX_def.ps | File | 1.77 KB | 0644 |
|
PM760p.upp | File | 1.13 KB | 0644 |
|
PM760pl.upp | File | 1.1 KB | 0644 |
|
PM820p.upp | File | 1.12 KB | 0644 |
|
PM820pl.upp | File | 1.09 KB | 0644 |
|
Stc670p.upp | File | 1.13 KB | 0644 |
|
Stc670pl.upp | File | 1.1 KB | 0644 |
|
Stc680p.upp | File | 1.11 KB | 0644 |
|
Stc680pl.upp | File | 1.09 KB | 0644 |
|
Stc740p.upp | File | 1.01 KB | 0644 |
|
Stc740pl.upp | File | 1.09 KB | 0644 |
|
Stc760p.upp | File | 1.11 KB | 0644 |
|
Stc760pl.upp | File | 1.09 KB | 0644 |
|
Stc777p.upp | File | 1.11 KB | 0644 |
|
Stc777pl.upp | File | 1.09 KB | 0644 |
|
Stp720p.upp | File | 1.13 KB | 0644 |
|
Stp720pl.upp | File | 1.09 KB | 0644 |
|
Stp870p.upp | File | 1.11 KB | 0644 |
|
Stp870pl.upp | File | 1.09 KB | 0644 |
|
acctest.ps | File | 4.17 KB | 0644 |
|
align.ps | File | 2.11 KB | 0644 |
|
bj8.rpd | File | 639 B | 0644 |
|
bj8gc12f.upp | File | 1.5 KB | 0644 |
|
bj8hg12f.upp | File | 1.5 KB | 0644 |
|
bj8oh06n.upp | File | 1.48 KB | 0644 |
|
bj8pa06n.upp | File | 1.49 KB | 0644 |
|
bj8pp12f.upp | File | 1.51 KB | 0644 |
|
bj8ts06n.upp | File | 1.49 KB | 0644 |
|
bjc6000a1.upp | File | 1.62 KB | 0644 |
|
bjc6000b1.upp | File | 1.62 KB | 0644 |
|
bjc610a0.upp | File | 1.49 KB | 0644 |
|
bjc610a1.upp | File | 1.48 KB | 0644 |
|
bjc610a2.upp | File | 1.48 KB | 0644 |
|
bjc610a3.upp | File | 1.49 KB | 0644 |
|
bjc610a4.upp | File | 1.49 KB | 0644 |
|
bjc610a5.upp | File | 1.48 KB | 0644 |
|
bjc610a6.upp | File | 1.48 KB | 0644 |
|
bjc610a7.upp | File | 1.48 KB | 0644 |
|
bjc610a8.upp | File | 1.49 KB | 0644 |
|
bjc610b1.upp | File | 1.48 KB | 0644 |
|
bjc610b2.upp | File | 1.48 KB | 0644 |
|
bjc610b3.upp | File | 1.49 KB | 0644 |
|
bjc610b4.upp | File | 1.49 KB | 0644 |
|
bjc610b6.upp | File | 1.48 KB | 0644 |
|
bjc610b7.upp | File | 1.49 KB | 0644 |
|
bjc610b8.upp | File | 1.49 KB | 0644 |
|
caption.ps | File | 1.72 KB | 0644 |
|
cbjc600.ppd | File | 10.89 KB | 0644 |
|
cbjc800.ppd | File | 11.22 KB | 0644 |
|
cdj550.upp | File | 1.65 KB | 0644 |
|
cdj690.upp | File | 1.95 KB | 0644 |
|
cdj690ec.upp | File | 2.01 KB | 0644 |
|
cid2code.ps | File | 4.39 KB | 0644 |
|
dmp_init.ps | File | 7.08 KB | 0644 |
|
dmp_site.ps | File | 459 B | 0644 |
|
dnj750c.upp | File | 2.74 KB | 0644 |
|
dnj750m.upp | File | 1.93 KB | 0644 |
|
docie.ps | File | 7.32 KB | 0644 |
|
escp_24.src | File | 350 B | 0644 |
|
font2pcl.ps | File | 18.01 KB | 0644 |
|
ghostpdf.ppd | File | 25.04 KB | 0644 |
|
gs_ce_e.ps | File | 2.17 KB | 0644 |
|
gs_il2_e.ps | File | 2.57 KB | 0644 |
|
gs_kanji.ps | File | 3.91 KB | 0644 |
|
gs_ksb_e.ps | File | 3.07 KB | 0644 |
|
gs_l.xbm | File | 1.9 KB | 0644 |
|
gs_l.xpm | File | 2.69 KB | 0644 |
|
gs_l_m.xbm | File | 1.91 KB | 0644 |
|
gs_lgo_e.ps | File | 2.67 KB | 0644 |
|
gs_lgx_e.ps | File | 1.72 KB | 0644 |
|
gs_m.xbm | File | 945 B | 0644 |
|
gs_m.xpm | File | 1.4 KB | 0644 |
|
gs_m_m.xbm | File | 955 B | 0644 |
|
gs_s.xbm | File | 594 B | 0644 |
|
gs_s.xpm | File | 957 B | 0644 |
|
gs_s_m.xbm | File | 604 B | 0644 |
|
gs_t.xbm | File | 345 B | 0644 |
|
gs_t.xpm | File | 605 B | 0644 |
|
gs_t_m.xbm | File | 355 B | 0644 |
|
gs_wl1_e.ps | File | 2.44 KB | 0644 |
|
gs_wl2_e.ps | File | 2.44 KB | 0644 |
|
gs_wl5_e.ps | File | 2.45 KB | 0644 |
|
gslp.ps | File | 20.24 KB | 0644 |
|
gsnup.ps | File | 2.57 KB | 0644 |
|
ht_ccsto.ps | File | 222.8 KB | 0644 |
|
image-qa.ps | File | 71.34 KB | 0644 |
|
jispaper.ps | File | 784 B | 0644 |
|
landscap.ps | File | 1.43 KB | 0644 |
|
lines.ps | File | 3.65 KB | 0644 |
|
mkcidfm.ps | File | 21.8 KB | 0644 |
|
necp2x.upp | File | 1.02 KB | 0644 |
|
necp2x6.upp | File | 1.04 KB | 0644 |
|
pdf2dsc.ps | File | 7.87 KB | 0644 |
|
pf2afm.ps | File | 14.94 KB | 0644 |
|
pfbtopfa.ps | File | 996 B | 0644 |
|
ppath.ps | File | 1.78 KB | 0644 |
|
pphs.ps | File | 6.68 KB | 0644 |
|
prfont.ps | File | 7.04 KB | 0644 |
|
printafm.ps | File | 4.78 KB | 0644 |
|
ps2ai.ps | File | 21.78 KB | 0644 |
|
ps2epsi.ps | File | 8.34 KB | 0644 |
|
ras1.upp | File | 215 B | 0644 |
|
ras24.upp | File | 219 B | 0644 |
|
ras3.upp | File | 214 B | 0644 |
|
ras32.upp | File | 196 B | 0644 |
|
ras4.upp | File | 220 B | 0644 |
|
ras8m.upp | File | 209 B | 0644 |
|
rollconv.ps | File | 12.23 KB | 0644 |
|
s400a1.upp | File | 1.42 KB | 0644 |
|
s400b1.upp | File | 1.57 KB | 0644 |
|
sharp.upp | File | 1.89 KB | 0644 |
|
sipixa6.upp | File | 529 B | 0644 |
|
st640ih.upp | File | 2.23 KB | 0644 |
|
st640ihg.upp | File | 1.47 KB | 0644 |
|
st640p.upp | File | 1.87 KB | 0644 |
|
st640pg.upp | File | 1.11 KB | 0644 |
|
st640pl.upp | File | 1.83 KB | 0644 |
|
st640plg.upp | File | 1.08 KB | 0644 |
|
stc.upp | File | 1.88 KB | 0644 |
|
stc1520h.upp | File | 2.1 KB | 0644 |
|
stc2.upp | File | 1.86 KB | 0644 |
|
stc200_h.upp | File | 1.8 KB | 0644 |
|
stc2_h.upp | File | 1.83 KB | 0644 |
|
stc2s_h.upp | File | 2.22 KB | 0644 |
|
stc300.upp | File | 2.09 KB | 0644 |
|
stc300bl.upp | File | 1.31 KB | 0644 |
|
stc300bm.upp | File | 1.4 KB | 0644 |
|
stc500p.upp | File | 1.86 KB | 0644 |
|
stc500ph.upp | File | 1.86 KB | 0644 |
|
stc600ih.upp | File | 2.23 KB | 0644 |
|
stc600p.upp | File | 1.12 KB | 0644 |
|
stc600pl.upp | File | 1.09 KB | 0644 |
|
stc640p.upp | File | 1.07 KB | 0644 |
|
stc740ih.upp | File | 2.07 KB | 0644 |
|
stc800ih.upp | File | 2.11 KB | 0644 |
|
stc800p.upp | File | 1.09 KB | 0644 |
|
stc800pl.upp | File | 1.07 KB | 0644 |
|
stc_h.upp | File | 1.87 KB | 0644 |
|
stc_l.upp | File | 734 B | 0644 |
|
stcany.upp | File | 673 B | 0644 |
|
stcany_h.upp | File | 681 B | 0644 |
|
stcinfo.ps | File | 24.92 KB | 0644 |
|
stcolor.ps | File | 4.95 KB | 0644 |
|
stocht.ps | File | 2.44 KB | 0644 |
|
traceimg.ps | File | 1.35 KB | 0644 |
|
traceop.ps | File | 2.51 KB | 0644 |
|
uninfo.ps | File | 5.85 KB | 0644 |
|
viewcmyk.ps | File | 1.94 KB | 0644 |
|
viewgif.ps | File | 5.27 KB | 0644 |
|
viewjpeg.ps | File | 5.56 KB | 0644 |
|
viewmiff.ps | File | 4.15 KB | 0644 |
|
viewpbm.ps | File | 10.04 KB | 0644 |
|
viewpcx.ps | File | 5.11 KB | 0644 |
|
viewps2a.ps | File | 1.11 KB | 0644 |
|
winmaps.ps | File | 3.52 KB | 0644 |
|
zeroline.ps | File | 2.26 KB | 0644 |
|