PrintBreakPage:
PROC [pa: PrintingP4V3.PrintAttributes] =
BEGIN
CedarVersion:
PROC
RETURNS [v:
ROPE] ~ {
out: IO.STREAM ← IO.ROS[];
IO.PutF[out, "Cedar %g.%g",
[integer[SystemVersion.release.major]], [integer[SystemVersion.release.minor]]];
IF SystemVersion.release.patch # 0
THEN
IO.PutF1[out, ".%g", [integer[SystemVersion.release.patch]]];
IO.PutF1[out, " of %t\n", [time[BasicTime.FromPupTime[SystemVersion.bootFileDate]]]];
v ← IO.RopeFromROS[out];
IO.Close[out];
};
CornerLogo:
SAFE
PROC ~
CHECKED {
CenterRope:
SAFE
PROC [context: Imager.Context, name:
ROPE, size:
REAL, r:
ROPE, x, y:
REAL] ~
CHECKED {
font: ImagerFont.Font ← ImagerFont.Scale[ImagerFont.Find[name], size];
box: ImagerFont.Extents ← ImagerFont.RopeBoundingBox[font: font, rope: r];
height: REAL ← box.descent + box.ascent;
length: REAL ← box.leftExtent + box.rightExtent;
Imager.SetXY[context: context, p: [x-length/2, y-height/2]];
Imager.SetFont[context: context, font: font];
Imager.ShowRope[context: context, rope: r];
};
Imager.TranslateT[context: context, t: [8.5*Imager.pointsPerInch, 11.0*Imager.pointsPerInch]];
Imager.RotateT[context: context, a: -45.0];
Imager.TranslateT[context: context, t: [0, -300]];
Imager.SetColor[context: context, color: Imager.black];
Imager.MaskRectangle[context: context, r: [-1000, 0, 10000, 10000]];
Imager.SetColor[context: context, color: Imager.white];
Imager.MaskRectangle[context: context, r: [-1000, 152, 10000, 8]];
Imager.MaskRectangle[context: context, r: [-1000, 104, 10000, 16]];
Imager.MaskRectangle[context: context, r: [-1000, 56, 10000, 24]];
Imager.MaskRectangle[context: context, r: [-1000, 8, 10000, 32]];
CenterRope[context, "Xerox/PressFonts/Logo-mrr", 40.0, "XEROX", 0, 180];
CenterRope[context, "Xerox/PressFonts/Classic-brr", 24.0, "INTERPRESS 3.0", 0, 136];
CenterRope[context, "Xerox/PressFonts/Classic-brr", 20.0, "Development Environment", 0, 96];
};
context: Imager.Context;
font: ImagerFont.Font;
error: ROPE;
status: RavenDriver.StatusType;
printObjectName, printObjectCreateDate, senderName: ROPE;
PrintAPage:
ENTRY
PROC[] =
TRUSTED
BEGIN
ENABLE
UNWIND =>
NULL;
[error, status]← RavenDriver.PrintFromSampleMap[bitmap
! RavenDriver.PrintingError => RETRY];
END;
TRUSTED {bitmap ← RavenDriver.GetPrinterSampleMap[];
context ← RavenDriver.ContextFromSampleMap[bitmap]};
ImagerSample.Clear[bitmap];
Imager.ScaleT[context: context, s: Imager.metersPerPoint];
Imager.DoSave[context: context, action: CornerLogo];
font ← ImagerFont.Scale[ImagerFont.Find["Xerox/PressFonts/Classic-mrr"], 10.0];
Imager.SetFont[context: context, font: font];
Imager.SetXY[context: context, p: [96, 386]];
Imager.ShowRope[context: context, rope: Rope.Concat["Printer: ", ThisMachine.Name[]]];
Imager.SetXY[context: context, p: [96, 374]];
Imager.ShowRope[context: context, rope: Rope.Concat["Software Version: ", CedarVersion[]]];
Imager.SetXY[context: context, p: [96, 350]];
[printObjectName, printObjectCreateDate, senderName] ← FindPrintStuff[pa];
Imager.ShowRope[context: context, rope: Rope.Concat["Interpress master: ", printObjectName]];
Imager.SetXY[context: context, p: [96, 338]];
Imager.ShowRope[context: context, rope: Rope.Concat["Creation Date: ", printObjectCreateDate]];
Imager.SetXY[context: context, p: [96, 314]];
Imager.ShowRope[context: context, rope: Rope.Concat["Printed by: ", senderName]];
Imager.SetXY[context: context, p: [96, 302]];
Imager.ShowRope[context: context, rope: Rope.Concat["Printing Date: ", IO.PutR1[IO.time[]]]];
PrintAPage[];
IF status = error
THEN {
XNSPSMessages.LogMessage[Rope.Concat[error, " while printing."]];
ERROR ABORTED;
};
ImagerSample.Clear[bitmap];
END;
PrintInterpressFile:
PROC [id: PrintingP4V3.RequestID, fileName:
ROPE, printOptions: PrintingP4V3.PrintOptions, copies:
INT] = {
ENABLE {
Imager.Error => {
XNSPSMessages.LogMessage[error.explanation, id]; ERROR ABORTED;
};
IPMaster.Error => {
XNSPSMessages.LogMessage[Atom.GetPName[error.code], id];
XNSPSMessages.LogMessage[error.explanation, id];
ERROR ABORTED;
};
IO.EndOfStream,
IO.Error =>
{XNSPSMessages.LogMessage["Unknown IO Error", id]; ERROR ABORTED;
};
};
status: RavenDriver.StatusType; error: ROPE;
master: Interpress.Master;
context: Imager.Context;
PrintAPage:
ENTRY
PROC[] =
TRUSTED
BEGIN
ENABLE
UNWIND =>
NULL;
[error, status]← RavenDriver.PrintFromSampleMap[bitmap
! RavenDriver.PrintingError => RETRY];
END;
TRUSTED {bitmap ← RavenDriver.GetPrinterSampleMap[];
context ← RavenDriver.ContextFromSampleMap[bitmap, fontTunerParms]};
master ← Interpress.Open[fileName, LogProc];
IF master.pages = 1
THEN {
-- reprint page 1 from the bitmap efficiently
XNSPSMessages.LogMessage[IO.PutFR1["Started page %g", IO.card[1]], id];
ImagerSample.Clear[bitmap];
Interpress.DoPage[master, 1, context, LogProc];
FOR i:
INT
IN [1 .. copies]
DO
XNSPSMessages.LogMessage["Printing", id];
PrintAPage[];
IF status = error
THEN {
XNSPSMessages.LogMessage[Rope.Concat[error, " while printing."], id];
ERROR ABORTED;
};
ENDLOOP;
}
ELSE {
-- struggle through interpretting each page in collation order. . .
FOR j:
INT
IN [1 .. copies]
DO
FOR i:
INT
IN [1 .. master.pages]
DO
XNSPSMessages.LogMessage[IO.PutFR1["Started page %g", IO.card[i]], id];
ImagerSample.Clear[bitmap];
Interpress.DoPage[master, i, context, LogProc];
XNSPSMessages.LogMessage["Printing", id];
PrintAPage[];
IF status = error
THEN {
XNSPSMessages.LogMessage[Rope.Concat[error, " while printing."], id];
ERROR ABORTED;
};
ENDLOOP;
ENDLOOP;
};
XNSPSMessages.LogMessage["All Done", id];
};