/usr/share/ghostscript/8.70/lib
NameSizeModeActions
acctest.ps43240644editdlrm
addxchar.ps98480644editdlrm
align.ps23130644editdlrm
bdftops.ps234030644editdlrm
bj8.rpd6390644editdlrm
bj8gc12f.upp15280644editdlrm
bj8hg12f.upp15270644editdlrm
bj8oh06n.upp15130644editdlrm
bj8pa06n.upp15210644editdlrm
bj8pp12f.upp15380644editdlrm
bj8ts06n.upp15260644editdlrm
bjc610a0.upp15230644editdlrm
bjc610a1.upp15120644editdlrm
bjc610a2.upp15130644editdlrm
bjc610a3.upp15180644editdlrm
bjc610a4.upp15260644editdlrm
bjc610a5.upp15130644editdlrm
bjc610a6.upp15130644editdlrm
bjc610a7.upp15160644editdlrm
bjc610a8.upp15220644editdlrm
bjc610b1.upp15120644editdlrm
bjc610b2.upp15130644editdlrm
bjc610b3.upp15180644editdlrm
bjc610b4.upp15260644editdlrm
bjc610b6.upp15130644editdlrm
bjc610b7.upp15170644editdlrm
bjc610b8.upp15220644editdlrm
bjc6000a1.upp16600644editdlrm
bjc6000b1.upp16600644editdlrm
caption.ps17210644editdlrm
cbjc600.ppd110400644editdlrm
cbjc800.ppd113830644editdlrm
cdj550.upp16860644editdlrm
cdj690.upp19950644editdlrm
cdj690ec.upp20560644editdlrm
cid2code.ps44750644editdlrm
decrypt.ps3500644editdlrm
dmp_init.ps72460644editdlrm
dmp_site.ps4590644editdlrm
dnj750c.upp28040644editdlrm
dnj750m.upp19710644editdlrm
docie.ps73730644editdlrm
dumphint.ps200440644editdlrm
escp_24.src3500644editdlrm
font2c.ps195910644editdlrm
font2pcl.ps175680644editdlrm
ghostpdf.ppd256430644editdlrm
gslp.ps196430644editdlrm
gsnup.ps27250644editdlrm
gs_ce_e.ps23640644editdlrm
gs_cmdl.ps48440644editdlrm
gs_fform.ps31620644editdlrm
gs_il2_e.ps27770644editdlrm
gs_kanji.ps39420644editdlrm
gs_ksb_e.ps32910644editdlrm
gs_l.xbm19450644editdlrm
gs_l.xpm27510644editdlrm
gs_lgo_e.ps28860644editdlrm
gs_lgx_e.ps19120644editdlrm
gs_l_m.xbm19550644editdlrm
gs_m.xbm9450644editdlrm
gs_m.xpm14370644editdlrm
gs_m_m.xbm9550644editdlrm
gs_pfile.ps43490644editdlrm
gs_rdlin.ps8620644editdlrm
gs_s.xbm5940644editdlrm
gs_s.xpm9570644editdlrm
gs_s_m.xbm6040644editdlrm
gs_t.xbm3450644editdlrm
gs_t.xpm6050644editdlrm
gs_t_m.xbm3550644editdlrm
gs_wl1_e.ps25300644editdlrm
gs_wl2_e.ps25280644editdlrm
gs_wl5_e.ps25460644editdlrm
ht_ccsto.ps2281940644editdlrm
image-qa.ps733230644editdlrm
impath.ps55380644editdlrm
jispaper.ps9300644editdlrm
landscap.ps15250644editdlrm
level1.ps1100644editdlrm
lines.ps38680644editdlrm
markhint.ps34730644editdlrm
markpath.ps18900644editdlrm
mkcidfm.ps73050644editdlrm
necp2x.upp10410644editdlrm
necp2x6.upp10650644editdlrm
packfile.ps103580644editdlrm
pcharstr.ps35840644editdlrm
pdf2dsc.ps83770644editdlrm
PDFA_def.ps11700644editdlrm
pdfopt.ps365160644editdlrm
pdfwrite.ps116760644editdlrm
PDFX_def.ps18680644editdlrm
pf2afm.ps153510644editdlrm
pfbtopfa.ps11410644editdlrm
PM760p.upp11600644editdlrm
PM760pl.upp11240644editdlrm
PM820p.upp11420644editdlrm
PM820pl.upp11170644editdlrm
ppath.ps19740644editdlrm
pphs3910644editdlrm
pphs.ps69220644editdlrm
prfont.ps64870644editdlrm
printafm.ps37750644editdlrm
ps2ai.ps224850644editdlrm
ps2ascii.ps446180644editdlrm
ps2epsi.ps81870644editdlrm
quit.ps50644editdlrm
ras1.upp2110644editdlrm
ras3.upp2100644editdlrm
ras4.upp2160644editdlrm
ras8m.upp2050644editdlrm
ras24.upp2150644editdlrm
ras32.upp1920644editdlrm
rollconv.ps117650644editdlrm
s400a1.upp14540644editdlrm
s400b1.upp16030644editdlrm
sharp.upp19360644editdlrm
showchar.ps29320644editdlrm
showpage.ps90644editdlrm
sipixa6.upp5290644editdlrm
st640ih.upp22770644editdlrm
st640ihg.upp15040644editdlrm
st640p.upp19100644editdlrm
st640pg.upp11370644editdlrm
st640pl.upp18740644editdlrm
st640plg.upp11010644editdlrm
stc.upp19190644editdlrm
stc2.upp19000644editdlrm
stc2s_h.upp22680644editdlrm
stc2_h.upp18750644editdlrm
stc200_h.upp18440644editdlrm
stc300.upp21320644editdlrm
stc300bl.upp13370644editdlrm
stc300bm.upp14260644editdlrm
stc500p.upp18990644editdlrm
stc500ph.upp18990644editdlrm
stc600ih.upp22770644editdlrm
stc600p.upp11470644editdlrm
stc600pl.upp11110644editdlrm
stc640p.upp10910644editdlrm
Stc670p.upp11590644editdlrm
Stc670pl.upp11240644editdlrm
Stc680p.upp11400644editdlrm
Stc680pl.upp11150644editdlrm
stc740ih.upp21230644editdlrm
Stc740p.upp10390644editdlrm
Stc740pl.upp11150644editdlrm
Stc760p.upp11410644editdlrm
Stc760pl.upp11150644editdlrm
Stc777p.upp11400644editdlrm
Stc777pl.upp11150644editdlrm
stc800ih.upp21540644editdlrm
stc800p.upp11110644editdlrm
stc800pl.upp10930644editdlrm
stc1520h.upp21500644editdlrm
stcany.upp6690644editdlrm
stcany_h.upp6770644editdlrm
stcinfo.ps257330644editdlrm
stcolor.ps52210644editdlrm
stc_h.upp19090644editdlrm
stc_l.upp7300644editdlrm
stocht.ps26460644editdlrm
Stp720p.upp11580644editdlrm
Stp720pl.upp11150644editdlrm
Stp870p.upp11400644editdlrm
Stp870pl.upp11150644editdlrm
traceimg.ps15280644editdlrm
traceop.ps27340644editdlrm
type1enc.ps25360644editdlrm
type1ops.ps75760644editdlrm
uninfo.ps61360644editdlrm
unprot.ps19040644editdlrm
viewcmyk.ps21130644editdlrm
viewgif.ps45730644editdlrm
viewjpeg.ps49490644editdlrm
viewmiff.ps37780644editdlrm
viewpbm.ps53070644editdlrm
viewpcx.ps43450644editdlrm
viewps2a.ps12820644editdlrm
wftopfa.ps89230644editdlrm
winmaps.ps37430644editdlrm
wrfont.ps181680644editdlrm
zeroline.ps24630644editdlrm
Edit: /usr/share/ghostscript/8.70/lib/pdfwrite.ps (11676B)
% Copyright (C) 1999, 2000, 2001 Aladdin Enterprises. 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. % % For more information about licensing, please refer to % http://www.ghostscript.com/licensing/. For information on % commercial licensing, go to http://www.artifex.com/licensing/ or % contact Artifex Software, Inc., 101 Lucas Valley Road #110, % San Rafael, CA 94903, U.S.A., +1(415)492-9861. % $Id: pdfwrite.ps 9246 2008-11-27 01:58:54Z alexcher $ % Writer for transmuting PDF files. % NOTES: % We do editing by replacing objects (in the cache) and then doing a % simple recursive walk with object renumbering. % Free variables: % RMap [per input file] (dict): input_obj# => output_obj# % PDFfile (file): current input file % OFile (file): current output file % XRef (dict): output_obj# => output_file_pos % ToWrite: 0..N-1 => [obj# gen#] .languagelevel 2 .setlanguagelevel .currentglobal true .setglobal /PDFWRDEBUG where { pop } { /PDFWRDEBUG false def } ifelse % ======== Long dictionary support =============== % % The key must be a non-negative iteger. /ld_dict { % ld_dict pop << 0 <<>> >> } bind def /ld_length { % ld_length 0 exch { exch pop length add } forall } bind def /ld_get { % ld_get dup 3 1 roll -15 bitshift get exch get } bind def /ld_put { % ld_put - 3 1 roll dup % any ldict key key 4 1 roll -15 bitshift % key any ldict key>>15 2 copy known { get % key any subdict 3 1 roll put % - } { 64 dict dup 6 1 roll % <<>> key any ldict key>>15 <<>> put put } ifelse % - } bind def /ld_known { % ld_known dup 3 1 roll -15 bitshift % key <<>> key<<15 2 copy known { get exch known } { pop pop pop //false } ifelse } bind def /ld_knownget { % ld_known false | true dup 3 1 roll -15 bitshift % key <<>> key<<15 2 copy known { get exch .knownget } { pop pop pop //false } ifelse } bind def /ld_def { % ld_def - currentdict 3 1 roll ld_put } bind def /ld_forall { % ld_clone << exch { dup length dict copy } forall >> } bind def % ================ Object mapping ================ % % Initialize the object number and location map. /omapinit { % - omapinit - /RMap 100 ld_dict def /XRef 100 ld_dict def PDFWRDEBUG { (omapinit) = } if } bind def % Map an object number. /omapnew { % omap RMap 1 index ld_knownget { exch pop //false } { PDFWRDEBUG { (omap\() print dup =only } if RMap dup ld_length 1 add % old# <<>> len+1 2 index exch dup % old# <<>> old# len+1 len+1 5 1 roll % len+1 old# <<>> old# len+1 ld_put pop //true % len+1 true PDFWRDEBUG { (\) = ) print 1 index = } if } ifelse } bind def /omap { % omap omapnew pop } bind def % Save and restore the object map. % Note that currentomap either returns a copy or calls omapinit. /currentomap { % currentomap { [RMap ld_clone XRef ld_clone] } { [RMap XRef] omapinit } ifelse } bind def /setomap { % setomap - aload pop /XRef exch def /RMap exch def PDFWRDEBUG { (setomap: #Xref = ) print XRef ld_length =only (, #RMap = ) print RMap ld_length = } if } bind def % ================ Writing ================ % % ---------------- Low-level output ---------------- % % Write a string on the output file. /ows { % ows - OFile exch writestring } bind def % ---------------- Scalars ---------------- % % Note that the '#' character isn't legal in a name unless it is a prefix % for a hex encoded character (for PDF 1.2 and later). The following assumes % that the names are already valid PDF 1.2+ names so that we can treat the % '#' as a legal character. The next two hex characters are already in the % set of valid name characters. PDF 1.1 and earlier allowed spaces in names % which probably wouldn't make it past the tokenizer anyway. /pdfnamechars (!"$&'*+,-.0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_`abcdefghijklmnopqrstuvwxyz|~) readonly def /pdfwritename { % pdfwritename - (/) ows .namestring { ( ) dup 0 4 -1 roll put //pdfnamechars 1 index search { pop pop pop } { pop 0 get 256 add 16 =string cvrs dup 0 (#) 0 get put } ifelse ows } forall } bind def % ---------------- Composite objects ---------------- % /pdfwriteprocs mark /resolveR { pdfwriteref } /O { pdfwritenewref } .dicttomark readonly def /pdfwritearray { % pdfwritearray - dup xcheck { aload pop //pdfwriteprocs exch get exec } { % Because of a bug in Acrobat's parser for linearization parameters, % we have to include some whitespace after the opening [ (!). ([ ) ows { pdfwritevalue (\n) ows } forall (]) ows } ifelse } bind def /pdfwritedict { % pdfwritedict - dup xcheck { pdfwritestream } { (<<) ows { exch pdfwritevalue ( ) ows pdfwritevalue (\n) ows } forall (>>) ows } ifelse } bind def % ---------------- References ---------------- % /pdfwritenewref { % pdfwritenewref - OFile exch write=only ( 0 R) ows } bind def /pdfwriteref { % pdfwriteref - 1 index omapnew { ToWrite dup length 5 -2 roll 2 packedarray put } { exch pop exch pop } ifelse pdfwritenewref } bind def /pdfcopystring 200 string def /pdfwritestream { % pdfwritestream - % Remove File, FilePosition, and StreamKey; % optimize by replacing an indirect Length. dup dup length dict copy % Stack: origdict dict dup /File undef dup /FilePosition undef dup /StreamKey undef dup /Length known { dup /Length get dup oforce ne { dup /Length 2 copy oget put } if } { 1 index /File get dup 3 index /FilePosition get setfileposition dup 0 (endstream) /SubFileDecode filter flushfile .fileposition 9 sub 2 index /FilePosition get sub 1 index exch /Length exch put } ifelse exch dup /File get dup 3 -1 roll /FilePosition get setfileposition pdfcopystream } bind def % We put copying the stream contents in separate procedures so that we % can replace this function if desired. /pdfcopybytes { % pdfcopybytes - { dup 0 eq { exit } if //pdfcopystring 0 2 index 2 index length .min getinterval 3 index exch readstring 3 1 roll 3 index 1 index writestring length sub exch not { exit } if } loop pop pop pop } bind def /pdfcopystream { % pdfcopystream - % (file has been positioned) 1 index pdfwritevalue (stream\n) ows exch /Length get OFile exch pdfcopybytes (endstream) ows } bind def % ---------------- General values/objects ---------------- % /pdfwritetypes mark % Scalars /nulltype { pop (null) ows } bind /integertype { =string cvs ows } bind /booleantype 1 index /realtype { =string cvs (e) search { % PDF has no exponential format exch pop % exp pre exch cvi exch (-) anchorsearch { ows } if (.) search { exch pop % exp (frac) (int) 1 index length % exp (frac) (int) len 3 1 roll % exp len (frac) (int) exch concatstrings % exp len (int_frac) 3 1 roll sub % (int_frac) exp-len exch % exp-len (int_frac) } if % exp (mant) 1 index 0 ge { ows { (0) ows } repeat (.) ows } { dup length % exp (mant) len 3 -1 roll add % (mant) exp+len dup 0 le { (0.) ows neg { (0) ows } repeat ows } { 2 copy 0 exch getinterval ows (.) ows 1 index length 1 index sub getinterval ows } ifelse } ifelse } { ows } ifelse } bind /stringtype { OFile exch write===only } bind /nametype { pdfwritename } bind % Composite/reference objects /arraytype { pdfwritearray } bind /packedarraytype 1 index /dicttype { pdfwritedict } bind .dicttomark readonly def /pdfwritevalue { % pdfwritevalue - PDFWRDEBUG { (****Writing: ) print dup === flush } if //pdfwritetypes 1 index type get exec } bind def % We make pdfwriteobjdef a separate procedure for external use. /pdfwriteobjheader { % pdfwriteobjheader - XRef 1 index OFile .fileposition ld_put PDFWRDEBUG { (XRef\() print dup =only (\) = ) print XRef 1 index ld_get = } if OFile exch write=only ( 0 obj\n) ows } bind def /pdfwriteobjdef { % pdfwriteobjdef - exch pdfwriteobjheader pdfwritevalue (\nendobj\n) ows } bind def /pdfwriteobj { % pdfwriteobj - 1 index exch resolveR exch omap exch pdfwriteobjdef } bind def % ---------------- File-level entities ---------------- % % Write a PDF file header. % Free variables: OFile, PDFversion. /pdfwriteheader { % - pdfwriteheader - (%PDF-) ows OFile PDFversion write= (%\347\363\317\323\n) ows } bind def % Write a cross-reference table and trailer. /pdfwritexref { % <#objs> pdfwritexref - (xref\n) ows OFile 2 index write=only ( ) ows OFile 1 index write= 1 index add 1 sub 1 exch { dup 0 eq { pop (0000000000 65535 f \n) ows } { XRef exch ld_get 1000000000 add =string cvs dup 0 (0) 0 get put ows ( 00000 n \n) ows } ifelse } for } bind def /pdfwritetrailer { % pdfwritetrailer - (trailer\n) ows % Since we always write a complete "classic" xref, the Trailer may need to be adjusted: % - remove keys that pertain to xref-streams and hybrid-xref PDFs; % - if it's a PDF stream, turn it into a PDF dict by removing keys used for % PDF streams (both standard and GS-specific), and the executable attribute dup /XRefStm known 1 index xcheck or { dup length dict copy dup {/Type/Index/W /XRefStm /Filter/DecodeParms/Length/File/FilePosition} { undef dup } forall pop % note: the executable attribute is "removed" by not being copied } if pdfwritevalue (\n) ows } bind def /pdfwritestartxref { % pdfwritestartxref - (startxref\n) ows OFile exch write= (%%EOF\n) ows } bind def % ================ Top-level control ================ % /pdfwrite { % pdfwrite - 10 dict begin /trailer exch def /OFile exch def /ToWrite 100 dict def omapinit % Write the PDF file header. pdfwriteheader % Write the objects. trailer { exch pop dup xcheck { % The only executable objects are references. aload pop pop pdfwriteobj } { pop } ifelse } forall % Walk the object graph. { ToWrite dup length dup 0 eq { pop pop exit } if 1 sub 2 copy get 3 1 roll undef aload pop pdfwriteobj } loop % Write the xref table and trailer. /xref OFile fileposition def 0 XRef ld_length 1 add pdfwritexref trailer dup length 1 add dict copy trailer xcheck { cvx } if dup /Size XRef ld_length 1 add put pdfwritetrailer xref pdfwritestartxref end } bind def .setglobal .setlanguagelevel