/usr/share/cagefs-skeleton/usr/share/ghostscript/lib
% Copyright (C) 2001-2021 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 a PostScript file to an EPSI file, adding the Preview Image. % If the file is already EPSF, then skip the creation of an EPSF, and % only add the preview. A warning is issued if the %%Pages: comment % indicates that there is more than a single page in the input file. % Expected invocation: % gs -q -dNOOUTERSAVE -dNODISPLAY -dLastPage=1 -sOutputFile=out.epsi --permit-file-read=in.ps -- ps2epsi.ps in.ps % Usually this will be invoked by the ps2epsi script (or .bat or .cmd versions) false % no errors from initial param check % NOOUTERSAVE is needed for the SAVE to not remove the tempfile (if one was needed) vmstatus pop pop 0 gt { (Error: missing -dNOOUTERSAVE option) = pop true } if % NODISPLAY may not be strictly needed, but we don't want to open the default device /NODISPLAY where { pop } { (Error: missing -dNODISPLAY option) = pop true } ifelse % LastPage is needed if we are using eps2write on a PostScript (or PDF) file that has multiple pages. /LastPage where { pop } { (Error: missing -dLastPage option) = pop true } ifelse % OutputFile is needed so that it gets on the permit-file-writing list /OutputFile where { pop } { (Error: missing -sOutputFile option) = pop true } ifelse .shellarguments not count 3 lt or count -1 roll or { (usage: gs -q -dNOOUTERSAVE -dNODISPLAY -dLastPage=1 -sOutputFile=out.epsi --permit-file-read=in.eps -- ps2epsi.ps in.ps) = quit } { dup /InputFile exch def (r) file /I exch def } ifelse /O OutputFile (w) file def /S 65535 string def /R { I S readline not { (Error: Unexpected end of file.) = quit } if } bind def /WL { O exch writestring O (\n) writestring } bind def % Write with linefeed /TName null def /EPSFheader (%!PS-Adobe-3.0 EPSF-3.0) def % Read the header to check if this file was EPSF R dup EPSFheader ne { % InputFile was not EPSF pop % discard the first line of the InputFile % run the file through eps2write (into a tempfile) to make an EPSF (_ps2epsi) (w+) .tempfile closefile /TName exch def /SAVE save def (eps2write) finddevice mark /OutputFile TName 3 index putdeviceprops pop setdevice InputFile run SAVE restore /I TName (r) file def R } if WL % Write the first line (either from InputFile or the tempfile % From the "5002 Encapsulated PostScript File Format Specification Version 3.0 1 May 1992" % The preview section must appear after the header comment section, but % before the document prologue definitions. That is, it should immediately % follow the %%EndComments: line in the EPS file. { % loop until we see the %%EndComments line, writing those lines to output R dup (%%EndComments) anchorsearch exch pop { % discard the match or extra copy of the string pop exit % found it } if % Check the %%Pages: comment to issue a warning if there is more than one page. dup (%%Pages:) anchorsearch exch pop { % discard the match or extra copy of the string cvi 1 gt { (Warning: EPSI files can only have 1 page, Only the first page will be in the preview.) = } if } if % Collect the BoundingBox data that will be used when generating the preview dup (%%BoundingBox:) anchorsearch exch pop { % discard the match or extra copy of the string mark exch token not { (Error: invalid BoundingBox parameters) = quit } if exch token not { (Error: invalid BoundingBox parameters) = quit } if exch token not { (Error: invalid BoundingBox parameters) = quit } if exch token not { (Error: invalid BoundingBox parameters) = quit } if exch pop ] /BBox exch def % Preview dimensions /PWidth BBox dup 2 get exch 0 get sub def /PHeight BBox dup 3 get exch 1 get sub def } if WL % send to output file with linefeed. } loop WL % send to output file with linefeed. % If the InputFile already has a preview, skip past it R dup (%%BeginPreview) anchorsearch exch pop { % discard the match or extra copy of the string pop % Read lines until after the %%EndPreview { R (%%EndPreview) anchorsearch exch pop { % discard the match or extra copy of the string pop pop exit % found it } if } loop % Get the next line for use after the generated preview R } if /LineAfterEndComments exch def //null (w+) .tempfile closefile % will be opened by bit device /Pname exch def (bit) selectdevice << /GrayValues 256 % Gray, not monochrome /OutputFile Pname /TextAlphaBits 4 /GraphicsAlphaBits 4 /LastPage 1 % TBD: does this work? /.IgnoreNumCopies true /Install { BBox 0 get neg BBox 1 get neg translate { 1.0 exch sub } settransfer } % EPSI 00 is white /HWResolution [ 72. 72. ] /PageSize [ PWidth PHeight ] >> setpagedevice InputFile run /P Pname (r) file def % Preview data file /SP PWidth string def % One string per image line % Write the preview O (%%BeginPreview: ) writestring O PWidth write==only O ( ) writestring O PHeight write==only O ( 8 ) writestring O PHeight PWidth 39 add 40 idiv mul write== % 40 bytes per line O flushfile 0 1 PHeight 1 sub { pop P SP readstring pop 0 40 PWidth { O (% ) writestring % 82 bytes on each line, plus EOL SP exch 40 PWidth 2 index sub .min getinterval O exch writehexstring O (\n) writestring } for pop } for (%%EndPreview) WL % Write the line that followed the %%EndComments LineAfterEndComments WL % Copy the remainder of the inputfile { I S readstring exch O exch writestring not { exit } if } loop % If we created a tempfile, delete it TName null ne { TName deletefile } if quit
.
Edit
..
Edit
PDFA_def.ps
Edit
PDFX_def.ps
Edit
PM760p.upp
Edit
PM760pl.upp
Edit
PM820p.upp
Edit
PM820pl.upp
Edit
Stc670p.upp
Edit
Stc670pl.upp
Edit
Stc680p.upp
Edit
Stc680pl.upp
Edit
Stc740p.upp
Edit
Stc740pl.upp
Edit
Stc760p.upp
Edit
Stc760pl.upp
Edit
Stc777p.upp
Edit
Stc777pl.upp
Edit
Stp720p.upp
Edit
Stp720pl.upp
Edit
Stp870p.upp
Edit
Stp870pl.upp
Edit
acctest.ps
Edit
align.ps
Edit
bj8.rpd
Edit
bj8gc12f.upp
Edit
bj8hg12f.upp
Edit
bj8oh06n.upp
Edit
bj8pa06n.upp
Edit
bj8pp12f.upp
Edit
bj8ts06n.upp
Edit
bjc6000a1.upp
Edit
bjc6000b1.upp
Edit
bjc610a0.upp
Edit
bjc610a1.upp
Edit
bjc610a2.upp
Edit
bjc610a3.upp
Edit
bjc610a4.upp
Edit
bjc610a5.upp
Edit
bjc610a6.upp
Edit
bjc610a7.upp
Edit
bjc610a8.upp
Edit
bjc610b1.upp
Edit
bjc610b2.upp
Edit
bjc610b3.upp
Edit
bjc610b4.upp
Edit
bjc610b6.upp
Edit
bjc610b7.upp
Edit
bjc610b8.upp
Edit
caption.ps
Edit
cbjc600.ppd
Edit
cbjc800.ppd
Edit
cdj550.upp
Edit
cdj690.upp
Edit
cdj690ec.upp
Edit
cid2code.ps
Edit
dnj750c.upp
Edit
dnj750m.upp
Edit
docie.ps
Edit
font2pcl.ps
Edit
ghostpdf.ppd
Edit
gs_ce_e.ps
Edit
gs_css_e.ps
Edit
gs_il2_e.ps
Edit
gs_kanji.ps
Edit
gs_ksb_e.ps
Edit
gs_l.xbm
Edit
gs_l.xpm
Edit
gs_l_m.xbm
Edit
gs_lgo_e.ps
Edit
gs_lgx_e.ps
Edit
gs_m.xbm
Edit
gs_m.xpm
Edit
gs_m_m.xbm
Edit
gs_s.xbm
Edit
gs_s.xpm
Edit
gs_s_m.xbm
Edit
gs_t.xbm
Edit
gs_t.xpm
Edit
gs_t_m.xbm
Edit
gs_wl1_e.ps
Edit
gs_wl2_e.ps
Edit
gs_wl5_e.ps
Edit
gslp.ps
Edit
gsnup.ps
Edit
ht_ccsto.ps
Edit
image-qa.ps
Edit
jispaper.ps
Edit
landscap.ps
Edit
lines.ps
Edit
mkcidfm.ps
Edit
necp2x.upp
Edit
necp2x6.upp
Edit
pdf2dsc.ps
Edit
pdf_info.ps
Edit
pf2afm.ps
Edit
pfbtopfa.ps
Edit
ppath.ps
Edit
pphs.ps
Edit
prfont.ps
Edit
printafm.ps
Edit
ps2ai.ps
Edit
ps2epsi.ps
Edit
ras1.upp
Edit
ras24.upp
Edit
ras3.upp
Edit
ras32.upp
Edit
ras4.upp
Edit
ras8m.upp
Edit
rollconv.ps
Edit
s400a1.upp
Edit
s400b1.upp
Edit
sharp.upp
Edit
sipixa6.upp
Edit
st640ih.upp
Edit
st640ihg.upp
Edit
st640p.upp
Edit
st640pg.upp
Edit
st640pl.upp
Edit
st640plg.upp
Edit
stc.upp
Edit
stc1520h.upp
Edit
stc2.upp
Edit
stc200_h.upp
Edit
stc2_h.upp
Edit
stc2s_h.upp
Edit
stc300.upp
Edit
stc300bl.upp
Edit
stc300bm.upp
Edit
stc500p.upp
Edit
stc500ph.upp
Edit
stc600ih.upp
Edit
stc600p.upp
Edit
stc600pl.upp
Edit
stc640p.upp
Edit
stc740ih.upp
Edit
stc800ih.upp
Edit
stc800p.upp
Edit
stc800pl.upp
Edit
stc_h.upp
Edit
stc_l.upp
Edit
stcany.upp
Edit
stcany_h.upp
Edit
stcinfo.ps
Edit
stcolor.ps
Edit
stocht.ps
Edit
traceimg.ps
Edit
traceop.ps
Edit
uninfo.ps
Edit
viewcmyk.ps
Edit
viewgif.ps
Edit
viewjpeg.ps
Edit
viewmiff.ps
Edit
viewpbm.ps
Edit
viewpcx.ps
Edit
viewps2a.ps
Edit
winmaps.ps
Edit
zeroline.ps
Edit