PrintBreakPage:
PROC [request: IPPrinterQueue.Request] =
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;
PrintAPage:
ENTRY
PROC[] =
BEGIN
ENABLE
UNWIND =>
NULL;
[error, status]← RavenDriver.PrintFromPixelMap[bitmap];
END;
bitmap ← RavenDriver.GetPrinterPixelMap[];
context ← RavenDriver.ContextFromPixelMap[bitmap];
ImagerPixelMap.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]];
Imager.ShowRope[context: context, rope: Rope.Concat["Interpress master: ", request.fileName]];
Imager.SetXY[context: context, p: [96, 338]];
Imager.ShowRope[context: context, rope: Rope.Concat["Creation Date: ", Convert.RopeFromTime[from: FS.FileInfo[name: request.fileName].created, start: years, end: seconds, includeDayOfWeek: TRUE, useAMPM: TRUE, includeZone: TRUE]]];
Imager.SetXY[context: context, p: [96, 314]];
Imager.ShowRope[context: context, rope: Rope.Concat["Printed by: ", request.requestor]];
Imager.SetXY[context: context, p: [96, 302]];
Imager.ShowRope[context: context, rope: Rope.Concat["Printing Date: ", request.requestTime]];
PrintAPage[];
IF status = error
THEN {
IPPrinterQueue.LogMessage[Rope.Concat[error, " while printing."]];
ERROR ABORTED;
};
ImagerPixelMap.Clear[bitmap];
END;
PrintInterpressFile:
PROC [fileName:
ROPE, requestNumber:
CARDINAL, abort:
REF
BOOLEAN, copies:
INT] = {
ENABLE {
Imager.Error => {
IPPrinterQueue.LogMessage[error.explanation, requestNumber]; ERROR ABORTED;
};
IPMaster.Error => {
IPPrinterQueue.LogMessage[Atom.GetPName[error.code], requestNumber];
IPPrinterQueue.LogMessage[error.explanation, requestNumber];
ERROR ABORTED;
};
IO.EndOfStream,
IO.Error =>
{IPPrinterQueue.LogMessage["Unknown IO Error", requestNumber]; ERROR ABORTED;
};
};
status: RavenDriver.StatusType; error: ROPE;
master: Interpress.Master;
context: Imager.Context;
PrintAPage:
ENTRY
PROC[] =
BEGIN
ENABLE
UNWIND =>
NULL;
[error, status]← RavenDriver.PrintFromPixelMap[bitmap];
END;
bitmap ← RavenDriver.GetPrinterPixelMap[];
context ← RavenDriver.ContextFromPixelMap[bitmap, fontTunerParms];
master ← Interpress.Open[fileName, LogProc];
IF master.pages = 1
THEN {
-- reprint page 1 from the bitmap efficiently
IF abort^ THEN ERROR ABORTED;
IPPrinterQueue.LogMessage[IO.PutFR1["Started page %g", IO.card[1]], requestNumber];
ImagerPixelMap.Clear[bitmap];
Interpress.DoPage[master, 1, context, LogProc];
FOR i:
INT
IN [1 .. copies]
DO
IPPrinterQueue.LogMessage["Printing", requestNumber];
PrintAPage[];
IF status = error
THEN {
IPPrinterQueue.LogMessage[Rope.Concat[error, " while printing."], requestNumber];
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
IF abort^ THEN ERROR ABORTED;
IPPrinterQueue.LogMessage[IO.PutFR1["Started page %g", IO.card[i]], requestNumber];
ImagerPixelMap.Clear[bitmap];
Interpress.DoPage[master, i, context, LogProc];
IPPrinterQueue.LogMessage["Printing", requestNumber];
PrintAPage[];
IF status = error
THEN {
IPPrinterQueue.LogMessage[Rope.Concat[error, " while printing."], requestNumber];
ERROR ABORTED;
};
ENDLOOP;
ENDLOOP;
};
IPPrinterQueue.LogMessage["All Done", requestNumber];
};