mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 13:20:42 +00:00
619 lines
14 KiB
PostScript
619 lines
14 KiB
PostScript
%%
|
|
%% Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
|
%%
|
|
|
|
%%
|
|
%% This PostScript file is used as input to tsol_labeled_banner,
|
|
%% which will prepend code to set the values of a number of
|
|
%% variables.
|
|
|
|
%% This PostScript file may be modified for local customizations or
|
|
%% internationalization. Comments marked "INTERNATIONALIZE:" show
|
|
%% places where changes may be made for internationalization. Comments
|
|
%% marked "CUSTOMIZE:" show places where some typical customization
|
|
%% changes may be made.
|
|
|
|
|
|
%% The following comments describe variables set by tsol_labeled_banner
|
|
|
|
%% These variables are from the print job information that can be
|
|
%% displayed with lpstat or lpq.
|
|
%%
|
|
%% /Job_Classification The classification (from the sensitivity label) to
|
|
%% be displayed at the top and bottom of the banner
|
|
%% /Job_Printer Printer Name
|
|
%% /Job_Host Host job was submitted from
|
|
%% /Job_User User who submitted the job
|
|
%% /Job_JobID Job number
|
|
%% /Job_Title Job title
|
|
%%
|
|
%% Job Page labels are added in pstops filter, so page labels should not be
|
|
%% added here.
|
|
%%
|
|
%% /Job_DoPageLabels Print page labels NO.
|
|
%%
|
|
%% These variables are generated from the system clock value.
|
|
%%
|
|
%% /Job_Date Date and time the job is being printed, in the
|
|
%% locale's default format
|
|
%% /Job_Hash A randomly generatred identifying number for
|
|
%% matching up the banner and trailer pages of the job
|
|
%%
|
|
%%
|
|
%% The following variables are the job's labels
|
|
%% as interpreted by the bcltobanner(3TSOL) library routine.
|
|
%%
|
|
%% /Job_Classification The classification (from the sensitivity label) to be
|
|
%% displayed at the top and bottom of the banner page.
|
|
%% /Job_Protect The sensitivity label to be displayed in the protect-as
|
|
%% field.
|
|
%% /Job_Caveats The caveats from the sesitivity label.
|
|
%% /Job_Channels The channels from the sesitivity label.
|
|
%%
|
|
%%
|
|
%% The following variables are the job's Sensitivity Label and
|
|
%% Information Label as interpreted by the bsltos and biltos library
|
|
%% routines.
|
|
%%
|
|
%% /Job_SL_Internal The sensitivity label in internal view format.
|
|
%% /Job_SL_External The sensitivity label in external view format.
|
|
|
|
/SeparatorPagesDict 100 dict def
|
|
userdict /JobDict known not {
|
|
userdict /JobDict 100 dict put
|
|
} if
|
|
|
|
SeparatorPagesDict
|
|
begin
|
|
|
|
%% CUSTOMIZE: To print header page label left-justified, set this to false
|
|
/center_label true def
|
|
|
|
/center_show where {
|
|
pop
|
|
} {
|
|
userdict /center_show
|
|
{
|
|
dup stringwidth exch
|
|
2 div neg exch rmoveto show
|
|
} put
|
|
} ifelse
|
|
|
|
/append where
|
|
{ pop }
|
|
{
|
|
/append
|
|
{
|
|
1 index length 1 index length add
|
|
1 index dup type /dicttype eq
|
|
{
|
|
pop dict
|
|
begin
|
|
exch { def } forall
|
|
{ def } forall
|
|
currentdict
|
|
end
|
|
}
|
|
{
|
|
/arraytype eq { array } { string } ifelse
|
|
dup 4 -1 roll 1 index copy length 4 -1 roll putinterval
|
|
}
|
|
ifelse
|
|
} def
|
|
} ifelse
|
|
|
|
/fontheight
|
|
systemdict /fontheight known
|
|
{ systemdict /fontheight get }
|
|
{
|
|
{
|
|
gsave
|
|
setfont (qf) true charpath flattenpath pathbbox
|
|
4 -1 roll pop exch pop exch sub
|
|
grestore
|
|
}
|
|
} ifelse
|
|
def
|
|
|
|
/m { moveto } def
|
|
/r { rmoveto } def
|
|
/rl { rlineto } def
|
|
|
|
/NewLine {
|
|
currentpoint exch pop
|
|
currentfont fontheight sub errorx0 exch moveto
|
|
} def
|
|
|
|
/clipSL {
|
|
/MaxWidth exch def
|
|
dup stringwidth pop MaxWidth gt {
|
|
{
|
|
dup stringwidth pop (<-) stringwidth pop add MaxWidth le {exit} if
|
|
dup 0 exch length 1 sub getinterval
|
|
} loop
|
|
(<-)
|
|
%% Concatenate strings
|
|
dup length 2 index length add 1 index pop string
|
|
dup 0 4 index putinterval
|
|
dup 4 -1 roll length 4 -1 roll putinterval
|
|
} if
|
|
} def
|
|
|
|
/BreakWithBlanks {
|
|
|
|
{restoftext ( ) search
|
|
{
|
|
/blank_nextword exch def pop
|
|
/blank_restoftext exch def
|
|
/blank_wordwidth blank_nextword stringwidth pop def
|
|
|
|
restoftext (/) search
|
|
{
|
|
/slash_nextword exch def pop
|
|
/slash_restoftext exch def
|
|
/slash_wordwidth slash_nextword stringwidth pop def
|
|
|
|
blank_wordwidth slash_wordwidth lt
|
|
{
|
|
/nextword blank_nextword def
|
|
/restoftext blank_restoftext def
|
|
/wordwidth blank_wordwidth def
|
|
/breakwidth ( ) stringwidth pop def
|
|
}
|
|
{
|
|
/nextword slash_nextword def
|
|
/restoftext slash_restoftext def
|
|
/wordwidth slash_wordwidth def
|
|
/breakwidth (/) stringwidth pop def
|
|
}ifelse
|
|
}
|
|
{
|
|
pop
|
|
/nextword blank_nextword def
|
|
/restoftext blank_restoftext def
|
|
/wordwidth blank_wordwidth def
|
|
/breakwidth ( ) stringwidth pop def
|
|
}ifelse
|
|
|
|
curwidth wordwidth add linewidth gt
|
|
{textstring startchar
|
|
lastwordbreak startchar sub
|
|
getinterval proc
|
|
/startchar lastwordbreak def
|
|
/curwidth wordwidth breakwidth add def }
|
|
|
|
{/curwidth curwidth wordwidth add
|
|
breakwidth add def
|
|
} ifelse
|
|
/lastwordbreak lastwordbreak
|
|
nextword length add 1 add def
|
|
}
|
|
{pop BreakWithSlashes exit}
|
|
ifelse
|
|
}loop
|
|
}def
|
|
|
|
/BreakWithSlashes
|
|
{
|
|
/breakchar (/) def
|
|
/breakwidth breakchar stringwidth pop def
|
|
{restoftext breakchar search
|
|
{/nextword exch def pop
|
|
/restoftext exch def
|
|
/wordwidth nextword stringwidth pop def
|
|
|
|
curwidth wordwidth add linewidth gt
|
|
{textstring startchar
|
|
lastwordbreak startchar sub
|
|
getinterval proc
|
|
/startchar lastwordbreak def
|
|
/curwidth wordwidth breakwidth add def }
|
|
|
|
{/curwidth curwidth wordwidth add
|
|
breakwidth add def
|
|
} ifelse
|
|
/lastwordbreak lastwordbreak
|
|
nextword length add 1 add def
|
|
}
|
|
{pop exit}
|
|
ifelse
|
|
}loop
|
|
}def
|
|
|
|
/BreakIntoLines
|
|
{/proc exch def
|
|
/linewidth exch 40 sub def
|
|
/textstring exch def
|
|
|
|
/curwidth 0 def
|
|
/lastwordbreak 0 def
|
|
/startchar 0 def
|
|
/restoftext textstring def
|
|
|
|
% begin scale the font if necessary
|
|
|
|
/allowedarea linewidth fbh 10 div mul def
|
|
/currentarea currentfont fontheight textstring stringwidth pop mul def
|
|
|
|
currentarea allowedarea gt
|
|
{
|
|
currentfont allowedarea currentarea div scalefont setfont
|
|
}if
|
|
|
|
% end scale the font if necessary
|
|
|
|
BreakWithBlanks
|
|
/lastchar textstring length def
|
|
textstring startchar lastchar startchar sub
|
|
getinterval proc
|
|
}def
|
|
|
|
|
|
/ShowBanner {
|
|
JobDict /Job_Proclam? get {
|
|
systemdict /showpage get cvx exec
|
|
} if
|
|
} def
|
|
|
|
/Init {
|
|
|
|
initgraphics
|
|
/#copies 1 def
|
|
initmatrix
|
|
erasepage
|
|
|
|
clippath pathbbox /fbh exch def
|
|
/fbw exch def
|
|
pop pop newpath
|
|
0 0 moveto
|
|
0 fbh translate
|
|
0 0 moveto
|
|
|
|
/margin fbh 20 div def
|
|
/imargin margin 1.1 mul def
|
|
/errorx0 imargin def
|
|
/errorx1 fbw imargin sub def
|
|
/errory1 imargin def
|
|
|
|
gsave
|
|
} def
|
|
|
|
% this stuff is lpd dependant.
|
|
|
|
/lpdglue {
|
|
userdict
|
|
begin
|
|
JobDict
|
|
begin
|
|
% If Job_Printer is defined, assume the others are too,
|
|
/Job_Printer where
|
|
{
|
|
pop
|
|
/Job_Proclam? true def
|
|
/Job_Endclam? true def
|
|
|
|
/Printer Job_Printer def
|
|
/Host Job_Host def
|
|
/User Job_User def
|
|
/Title Job_Title def
|
|
/JobID Job_JobID def
|
|
/Date Job_Date def
|
|
|
|
%% CUSTOMIZE: To use a different string at the top and
|
|
%% bottom of each page, change the following line. For
|
|
%% instance, to use the sensitivity label in external view
|
|
%% format, change the line to: /PageLabel Job_SL_External def
|
|
%% To eliminate page labels completely, change this line to
|
|
%% set the page label to an empty string: /PageLabel () def
|
|
/PageLabel Job_SL_Internal def
|
|
Job_Protect () eq
|
|
{
|
|
%% Job_Protect is empty because SLs are turned
|
|
%% off in secconf. (Turning off SLs is actually not yet
|
|
%% supported by the system.)
|
|
/Protect () def
|
|
/Protect_Text1 () def
|
|
/Protect_Text2 () def
|
|
}
|
|
{
|
|
%% INTERNATIONALIZE/CUSTOMIZE: Replace the text between
|
|
%% parentheses with the appropriate text to display
|
|
%% above and below the SL.
|
|
/Protect Job_Protect def
|
|
/Protect_Text1 (This output must be protected as:) def
|
|
/Protect_Text2 (unless manually reviewed and downgraded.) def
|
|
}
|
|
ifelse
|
|
|
|
%% CUSTOMIZE: To not print the caveats, change
|
|
%% this line to /Caveats () def
|
|
/Caveats Job_Caveats def
|
|
%% CUSTOMIZE: To not print the channels, change
|
|
%% this line to /Channels () def
|
|
/Channels Job_Channels def
|
|
|
|
%% CUSTOMIZE: To not print the hash number, change
|
|
%% this line to /Hash () def
|
|
/Hash Job_Hash def
|
|
|
|
%% CUSTOMIZE: To not print the head label, change
|
|
%% this line to /HeadLabel () def
|
|
%% You may also substitute another string. For example, to use
|
|
%% the SL in internal view format: /HeadLabel Job_SL_Internal def
|
|
/HeadLabel Job_Classification def
|
|
} {
|
|
/Job_Proclam? false def
|
|
/Job_Endclam? false def
|
|
} ifelse
|
|
end
|
|
end
|
|
} def
|
|
|
|
/border {
|
|
gsave
|
|
setlinewidth
|
|
setgray
|
|
30 -20 moveto
|
|
0 60 fbh sub rlineto
|
|
fbw 60 sub 0 rlineto
|
|
0 fbh 60 sub rlineto
|
|
60 currentlinewidth 2 div sub fbw sub 0 rlineto
|
|
stroke
|
|
grestore
|
|
} def
|
|
|
|
/TSOLJobInfo {
|
|
gsave
|
|
|
|
/fontscale fbh 50 div def
|
|
/Courier-Bold findfont fontscale scalefont setfont
|
|
/ClippedLabel
|
|
JobDict /HeadLabel get
|
|
SeparatorPagesDict /fbw get 90 sub
|
|
SeparatorPagesDict /clipSL get exec
|
|
def
|
|
|
|
/head_len {
|
|
ClippedLabel stringwidth pop 5 add
|
|
HeadLabel () eq { pop 0 } if
|
|
} def
|
|
15 setlinewidth
|
|
fbw 2 div head_len 2 div sub -20 moveto
|
|
head_len 0 rlineto stroke
|
|
1 setgray
|
|
fbw 10 div -25 m gsave ClippedLabel
|
|
currentpoint exch pop fbw 2 div exch moveto
|
|
center_show NewLine grestore
|
|
|
|
0 setgray
|
|
/fontscale fbh 70 div def
|
|
|
|
/Helvetica findfont fontscale scalefont setfont
|
|
0 fbh 8 div neg r Protect_Text1
|
|
currentpoint exch pop
|
|
center_label {
|
|
fbw 2 div exch moveto center_show
|
|
}
|
|
{
|
|
fbw 10 div exch moveto show
|
|
}
|
|
ifelse
|
|
/fontscale fbh 60 div def
|
|
/Helvetica-Bold findfont fontscale scalefont setfont
|
|
|
|
0 fbh 150 div neg r
|
|
Protect
|
|
fbw errorx0 3 mul sub % width minus margins
|
|
|
|
center_label {
|
|
{NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
|
|
BreakIntoLines
|
|
}
|
|
{
|
|
{NewLine currentpoint exch pop fbw 10 div exch moveto show}
|
|
BreakIntoLines
|
|
}
|
|
ifelse
|
|
|
|
/fontscale fbh 70 div def
|
|
/Helvetica findfont fontscale scalefont setfont
|
|
0 fbh 50 div neg r Protect_Text2
|
|
currentpoint exch pop
|
|
center_label {
|
|
fbw 2 div exch moveto center_show
|
|
}
|
|
{
|
|
fbw 10 div exch moveto show
|
|
}
|
|
ifelse
|
|
|
|
/fontscale fbh 60 div def
|
|
/Helvetica-Bold findfont fontscale scalefont setfont
|
|
0 fbh 200 div neg r
|
|
|
|
0 fbh 10 div neg r
|
|
|
|
/fontscale fbh 40 div def
|
|
/Helvetica-Bold findfont fontscale scalefont setfont
|
|
|
|
0 fbh 30 div neg r gsave
|
|
%% INTERNATIONALIZE: Replace the text between
|
|
%% parentheses with the appropriate text.
|
|
(User: ) User (@) Host append append append
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
NewLine grestore
|
|
0 fbh 30 div neg r gsave
|
|
%% INTERNATIONALIZE: Replace the text between
|
|
%% parentheses with the appropriate text.
|
|
(Job: ) JobID append
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
NewLine grestore
|
|
0 fbh 30 div neg r gsave
|
|
Title
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
NewLine grestore
|
|
/fontscale fbh 70 div def
|
|
/Helvetica findfont fontscale scalefont setfont
|
|
0 fbh 30 div neg r gsave
|
|
%% INTERNATIONALIZE: Replace the text between
|
|
%% parentheses with the appropriate text.
|
|
(Printed at: ) Date append
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
NewLine grestore
|
|
0 fbh 30 div neg r gsave
|
|
%% INTERNATIONALIZE: Replace the text between
|
|
%% parentheses with the appropriate text.
|
|
(Printer queue: ) Printer append
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
NewLine grestore
|
|
|
|
/Helvetica-Bold findfont fontscale scalefont setfont
|
|
0 fbh 20 div neg r
|
|
Caveats
|
|
fbw errorx0 3 mul sub % width minus margins
|
|
{NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
|
|
BreakIntoLines
|
|
|
|
0 fbh 30 div neg r
|
|
Channels
|
|
fbw errorx0 3 mul sub % width minus margins
|
|
{NewLine currentpoint exch pop fbw 2 div exch moveto center_show}
|
|
BreakIntoLines
|
|
|
|
/fontscale fbh 50 div def
|
|
/Courier-Bold findfont fontscale scalefont setfont
|
|
15 setlinewidth
|
|
fbw 2 div head_len 2 div sub 40 fbh sub moveto
|
|
head_len 0 rlineto stroke
|
|
1 setgray
|
|
fbw 10 div 35 fbh sub m gsave ClippedLabel
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
NewLine grestore
|
|
|
|
grestore
|
|
} def
|
|
|
|
/JobHashInfo {
|
|
gsave
|
|
0 setgray
|
|
/fontscale fbh 50 div def
|
|
/Helvetica-Bold findfont fontscale scalefont setfont
|
|
|
|
%% Upper left corner
|
|
Hash
|
|
fbw 12 div 50 neg m gsave show grestore
|
|
|
|
%% Lower left corner
|
|
Hash
|
|
fbw 12 div fbh 60 sub neg m gsave show grestore
|
|
|
|
%% Lower right corner
|
|
Hash dup stringwidth pop
|
|
fbw 11 mul 12 div exch sub fbh 60 sub neg m gsave show grestore
|
|
|
|
%% Upper right corner
|
|
Hash dup stringwidth pop
|
|
fbw 11 mul 12 div exch sub 50 neg m gsave show grestore
|
|
|
|
/fontscale fbh 40 div def
|
|
/Helvetica-Bold findfont fontscale scalefont setfont
|
|
fbw 10 div 120 fbh sub m gsave
|
|
currentpoint exch pop fbw 2 div exch moveto center_show
|
|
|
|
grestore
|
|
} def
|
|
|
|
|
|
/jobproclam {
|
|
JobDict
|
|
begin
|
|
Job_Proclam?
|
|
%% INTERNATIONALIZE: Replace the text between
|
|
%% parentheses with the appropriate text.
|
|
{ TSOLJobInfo (JOB START) JobHashInfo}
|
|
{ 0 -100 rmoveto }
|
|
ifelse
|
|
end
|
|
} def
|
|
|
|
/jobendclam {
|
|
JobDict
|
|
begin
|
|
Job_Endclam?
|
|
%% INTERNATIONALIZE: Replace the text between
|
|
%% parentheses with the appropriate text.
|
|
{ TSOLJobInfo (JOB END) JobHashInfo}
|
|
{ 0 -100 rmoveto }
|
|
ifelse
|
|
end
|
|
} def
|
|
|
|
|
|
/JobProclam {
|
|
jobproclam
|
|
} def
|
|
|
|
/JobEndclam {
|
|
jobendclam
|
|
} def
|
|
|
|
% A fancy box around page
|
|
|
|
/BannerBorder {
|
|
.7 16 border
|
|
} def
|
|
|
|
/TrailerBorder {
|
|
0 4 border
|
|
} def
|
|
|
|
%
|
|
% -------------------------------------------------------------------------
|
|
%
|
|
% The structure of separator pages is defined below. This is invoked by
|
|
% using a line like:
|
|
%
|
|
% SeparatorPagesDict /Banner get exec
|
|
%
|
|
|
|
/Banner {
|
|
SeparatorPagesDict
|
|
begin
|
|
Init
|
|
lpdglue
|
|
BannerBorder
|
|
JobProclam
|
|
end
|
|
} def
|
|
|
|
/Trailer {
|
|
SeparatorPagesDict
|
|
begin
|
|
Init
|
|
lpdglue
|
|
TrailerBorder
|
|
JobEndclam
|
|
end
|
|
} def
|
|
|
|
/SkipPageLabels false def
|
|
end
|
|
|
|
SeparatorPagesDict begin
|
|
clippath pathbbox /fbh exch def
|
|
/fbw exch def
|
|
pop pop
|
|
lpdglue
|
|
end
|
|
|
|
|
|
JobDict /Job_DoPageLabels get (YES) eq
|
|
JobDict /PageLabel get () ne and {
|
|
userdict begin
|
|
/showpage {
|
|
systemdict /showpage get cvx exec
|
|
} bind def
|
|
end
|
|
}if
|
|
|
|
%% End of tsol_separator.ps
|