PrintTiogaViewer:
PUBLIC
ENTRY
PROCEDURE [
viewer: ViewerClasses.Viewer,
nameForSeparatorPage: Rope.ROPE,
aborted: REF BOOLEAN,
server: Rope.ROPE ← NIL,
copies: INT ← 1,
messageProc: PROC [Rope.ROPE] ← NIL
] = {ENABLE UNWIND => NULL;
node: TextNode.Ref ← NARROW[viewer.data, TEditDocument.TEditDocumentData].text;
outputHandle: TSOutput.Handle ← TSOutputPress.CreateWithCursor[
stream: FileIO.Open["temp.press$", overwrite],
documentName: nameForSeparatorPage,
cursorObject: NIL
];
galley: TSObject.ItemList;
style: NodeStyle.Ref;
isAborted: PROC RETURNS [BOOLEAN] = {RETURN[IF aborted = NIL THEN FALSE ELSE aborted^]};
progressProc: PressPrinter.ProgressProc =
TRUSTED {
IF messageProc # NIL THEN messageProc[handle.CurrentStateMessage[]];
IF aborted # NIL AND aborted^ THEN handle.Abort[];
};
IF server = NIL THEN server ← UserProfile.Token["Hardcopy.PressPrinter", ""];
[galley, style] ← TSTranslate.TreeToVlist[node];
[] ← TSJaMPageBuilder.RunPageBuilder[
galley: galley,
style: style,
output: outputHandle,
abortCheckProc: isAborted,
documentName: nameForSeparatorPage
];
outputHandle.Close[];
[] ← PressPrinter.SendPressFile[
fileName: "temp.press$",
server: server,
progressProc: progressProc,
copies: copies,
userName: UserCredentials.GetUserCredentials[].name
];
};