📄 ps-prin1.ps
字号:
0 LineHeight 0.65 mul rmoveto PrintWidth 0 rlineto 0 PrintHeight neg rlineto PrintWidth neg 0 rlineto 0 PrintHeight rlineto fill grestore PrintWidth InterColumn add 0 rmoveto }repeat grestore }if}def% tx ty rotation xscale yscale xpos ypos BeginBackImage/BeginBackImage{ /-save-image- save def /showpage{}def translate scale rotate translate}def/EndBackImage{-save-image- restore}def% string fontsize fontname rotation gray xpos ypos ShowBackText/ShowBackText{ gsave translate setgray rotate findfont exch dup/-offset- exch -0.25 mul def scalefont setfont 0 -offset- moveto /-saveLineThickness- LineThickness def /LineThickness 1 def false doOutline /LineThickness -saveLineThickness- def grestore}def/SetPageSize{ BMark/PageSize[PageWidth LandscapePageHeight LandscapeMode{exch}if]EMark setpagedevice}def/BeginDoc{ % ---- Remember space width of the normal text font `f0'. /SpaceWidth/f0 findfont setfont( )stringwidth pop def % ---- save the state of the document (useful for ghostscript!) /docState save def % ---- [andrewi] set PageSize based on chosen dimensions UseSetpagedevice{ WarnPaperSize{SetPageSize}{mark{SetPageSize}stopped cleartomark}ifelse }if /ColumnWidth PrintWidth InterColumn add def % ---- define where printing will start /f0 F % this installs Ascent /PrintStartY PrintHeight Ascent sub def /ColumnIndex 1 def /N-Up-Counter N-Up-End 1 sub def /PLScounter PrintLineStart def}def/EndDoc{ % ---- restore the state of the document (useful for ghostscript!) docState restore}def/BeginDSCPage{ % ---- when 1st column, save the state of the page ColumnIndex 1 eq{/pageState save def}if % ---- save the state of the column /columnState save def}def/PrintHeaderWidth PrintOnlyOneHeader{PrintPageWidth}{PrintWidth}ifelse def/BeginPage{ /LinesPrinted exch def % ---- when 1st column, print all background effects ColumnIndex 1 eq{ 0 PrintStartY moveto % move to where printing will start printBackground Zebra{printZebra}if printGlobalBackground printLocalBackground }if PrintOnlyOneHeader{ColumnIndex 1 eq}{true}ifelse dup PrintHeader and{ PrintHeaderFrame{HeaderFrame}if HeaderText }if PrintFooter and{ PrintFooterFrame{FooterFrame}if FooterText }if 0 PrintStartY moveto % move to where printing will start /LineNumber where {pop SyncLineZebra {/H PageNumber 1 sub NumberOfColumns mul ColumnIndex 1 sub add LinesPerColumn mul ZebraHeight mod def /PLScounter H PrintLineStart ge{0}{PrintLineStart H sub}ifelse def /PrintLineStep ZebraHeight H sub def}if}if PLN}def/EndPage{bg{eolbg}if}def/EndDSCPage{ ColumnIndex NumberOfColumns eq{ % ---- restore the state of the page pageState restore /ColumnIndex 1 def % ---- N-up printing N-Up 1 gt{ N-Up-Counter 0 gt {% ---- Next page on same row /N-Up-Counter N-Up-Counter 1 sub def N-Up-XColumn N-Up-YColumn} {% ---- Next page on next line /N-Up-Counter N-Up-End 1 sub def N-Up-XLine N-Up-YLine}ifelse translate }if }{ % else % ---- restore the state of the current column columnState restore % ---- and translate to the next column ColumnWidth 0 translate /ColumnIndex ColumnIndex 1 add def }ifelse}def/TextStart{ LeftMargin BottomMargin PrintFooter{ FooterPad add FooterLines FooterLineHeight mul add FooterPad add FooterOffset add}if}def% stack: number-of-pages-per-sheet |- --/BeginSheet{ /sheetState save def /pages-per-sheet exch def % ---- translate to bottom-right corner of Portrait page LandscapeMode{ LandscapePageHeight 0 translate 90 rotate }if % ---- [jack] Kludge: my ghostscript window is 21x27.7 instead of 21x29.7 /JackGhostscript where{pop 1 27.7 29.7 div scale}if UpsideDown{PageWidth LandscapePageHeight translate 180 rotate}if % ---- N-Up printing N-Up 1 gt{ % ---- landscape N-Up-Landscape{ PageWidth 0 translate 90 rotate }if N-Up-Margin dup translate % ---- scale LandscapeMode{ /HH PageWidth def /WW LandscapePageHeight def }{ /HH LandscapePageHeight def /WW PageWidth def }ifelse /xx 0 def N-Up-Landscape{ /ww WW WW mul N-Up-Lines HH mul div def /cc HH N-Up-Columns N-Up-Missing add div def ww cc gt{/xx WW def/WW cc ww div WW mul def/xx xx WW sub def}if }{ /hh HH N-Up-Columns N-Up-Missing add div def /cc HH N-Up-Lines div def hh cc gt{/xx WW def/WW cc hh div WW mul def/xx xx WW sub def}if }ifelse WW N-Up-Margin sub N-Up-Margin sub N-Up-Landscape {N-Up-Lines div HH} {N-Up-Columns N-Up-Missing add div WW}ifelse div dup scale LandscapeMode{/yy 0 def}{/yy xx def/xx 0 def}ifelse xx N-Up-Repeat 1 sub LandscapePageHeight mul yy add translate % ---- go to start position in page matrix N-Up-XStart N-Up-Missing 0.5 mul LandscapeMode {LandscapePageHeight mul N-Up-YStart add} {PageWidth mul add N-Up-YStart}ifelse translate }if % ---- translate to lower left corner of TEXT TextStart translate % ---- N-up printing N-Up 1 gt N-Up-Border and pages-per-sheet 0 gt and{ % ---- page border gsave 0 setgray TextStart exch neg exch neg moveto N-Up-Repeat {N-Up-End {gsave PageWidth 0 rlineto 0 LandscapePageHeight rlineto PageWidth neg 0 rlineto closepath stroke grestore /pages-per-sheet pages-per-sheet 1 sub def pages-per-sheet 0 le{exit}if N-Up-XColumn N-Up-YColumn rmoveto }repeat pages-per-sheet 0 le{exit}if N-Up-XLine N-Up-XColumn sub N-Up-YLine rmoveto }repeat grestore }if}def/EndSheet{ showpage sheetState restore}def/SetHeaderLines{ % nb-lines -- /HeaderLines exch def % ---- bottom up HeaderPad HeaderLines 1 sub HeaderLineHeight mul add HeaderTitleLineHeight add HeaderPad add /HeaderHeight exch def}def/SetFooterLines{ % nb-lines -- /FooterLines exch def % ---- bottom up FooterPad FooterLines FooterLineHeight mul add FooterPad add /FooterHeight exch def}def% |---------|% | tm |% |---------|% | header |% |-+-------| <-- (x y)% | ho |% |---------|% | text |% |---------|% | fo |% |---------|% | footer |% |-+-------| <-- (0 0)% | bm |% |---------|% -- |- x y/HeaderFrameStart{0 PrintHeight HeaderOffset add}def/FooterFrameStart{0 FooterHeight FooterOffset add neg}def/doFramePath{ /h exch def PrintHeaderWidth 0 rlineto 0 h rlineto PrintHeaderWidth neg 0 rlineto 0 h neg rlineto}def/HeaderFramePath{HeaderHeight doFramePath}def/FooterFramePath{FooterHeight doFramePath}def% /path-fun /start-fun vector-property doFrame/doFrame{ /vecFrame exch def /startFrame exch load def /pathFrame exch load def gsave vecFrame 2 get setlinewidth % frame border width % ---- do the shadow of the next rectangle startFrame moveto 1 -1 rmoveto pathFrame vecFrame 4 get SetColor fill % frame shadow color % ---- do the next rectangle ... startFrame moveto pathFrame gsave vecFrame 1 get SetColor fill grestore % frame background gsave vecFrame 3 get SetColor stroke grestore % frame border color grestore}def/HeaderFrame{/HeaderFramePath /HeaderFrameStart HeaderFrameProperties doFrame}def/FooterFrame{/FooterFramePath /FooterFrameStart FooterFrameProperties doFrame}def/HeaderStart{ HeaderFrameStart exch HeaderPad add exch % horizontal pad % ---- bottom up HeaderPad add % vertical pad HeaderDescent sub HeaderLineHeight HeaderLines 1 sub mul add}def/FooterStart{ FooterFrameStart exch FooterPad add exch % horizontal pad % ---- bottom up FooterPad add % vertical pad FooterDescent sub FooterLineHeight FooterLines 1 sub mul add}def/strcat{ dup length 3 -1 roll dup length dup 4 -1 roll add string dup 0 5 -1 roll putinterval dup 4 2 roll exch putinterval}def/pagenumberstring{ PageNumber 32 string cvs ShowNofN{(/)strcat PageCount 32 string cvs strcat}if}def% lines is-right HeaderOrFooterTextLines/HeaderOrFooterTextLines{ /is_right exch def HFStart moveto { % ---- process the lines aload pop exch F gsave dup xcheck{exec}if is_right{ dup stringwidth pop PrintHeaderWidth exch sub HFPad HFPad add sub 0 rmoveto }if HFColor SetColor show grestore 0 HFLineHeight neg rmoveto }forall}def% right-lines left-lines /start lineheight pad fore-color HeaderOrFooterText/HeaderOrFooterText{ /HFColor exch def /HFPad exch def /HFLineHeight exch def /HFStart exch load def % -- rightLines leftLines -- at stack % ---- hack: `PN 1 and' == `PN 2 modulo' % ---- if even page number and duplex, then exchange left and right PageNumber 1 and 0 eq SwitchHeader and{exch}if % ---- process the left lines false HeaderOrFooterTextLines % ---- process the right lines true HeaderOrFooterTextLines}def/HeaderText{ HeaderLinesRight HeaderLinesLeft /HeaderStart HeaderLineHeight HeaderPad HeaderFrameProperties 0 get HeaderOrFooterText}def/FooterText{ FooterLinesRight FooterLinesLeft /FooterStart FooterLineHeight FooterPad FooterFrameProperties 0 get HeaderOrFooterText}def/ReportFontInfo{ 2 copy /t0 3 1 roll DefFont /t0 F /lh FontHeight def /sw( )stringwidth pop def /aw(01234567890abcdefghijklmnopqrstuvwxyz)dup length exch stringwidth pop exch div def /t1 12/Helvetica-Oblique DefFont /t1 F gsave (languagelevel = )show languagelevel 32 string cvs show grestore 0 FontHeight neg rmoveto gsave (For )show 128 string cvs show ( )show 32 string cvs show ( point, the line height is )show lh 32 string cvs show (, the space width is )show sw 32 string cvs show (,)show grestore 0 FontHeight neg rmoveto gsave (and a crude estimate of average character width is )show aw 32 string cvs show (.)show grestore 0 FontHeight neg rmoveto}def% cm to point/cm{72 mul 2.54 div}def/ReportAllFontInfo{ % key = font name value = font dictionary FontDirectory{pop 10 exch ReportFontInfo}forall}def% 3 cm 20 cm moveto 10/Courier ReportFontInfo showpage% 3 cm 20 cm moveto ReportAllFontInfo showpage% === END ps-print prologue 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -