IF arg0 =
NIL
THEN CommanderOps.Failed[cmd.procData.doc]
ELSE {
inName: ROPE ~ arg0;
outName: ROPE ~ arg0.Concat[".cip"];
input: InterpressInterpreter.Master = InterpressInterpreter.Open[inName, Log];
output: ImagerInterpress.Ref ~ ImagerInterpress.Create[outName, "Interpress/Xerox/2.0 "];
ppi: REAL = 300;
pixelsPerDot: REAL = 5.525;
metersPerInch: REAL = 0.0254;
ppm: REAL = ppi/metersPerInch;
scanMode: ImagerTransformation.ScanMode ¬ [slow: right, fast: up];
pageHeight: REAL = 11.0;
pageWidth: REAL = 8.5;
sIn: REAL = SELECT scanMode.slow FROM up, down => pageHeight, ENDCASE => pageWidth;
fIn: REAL = SELECT scanMode.fast FROM up, down => pageHeight, ENDCASE => pageWidth;
size: SF.Vec = [s: Real.Round[sIn*ppi], f: Real.Round[fIn*ppi]];
bitmapContext: Imager.Context = ImagerPrintContext.SimpleCreate[deviceSpaceSize: size, scanMode: scanMode, surfaceUnitsPerInch: [ppi, ppi], logicalDevice: 0, pixelsPerHalftoneDot: 5.525, toners: [black: TRUE]];
bitmap: ImagerSample.RasterSampleMap ¬ ImagerSample.NewSampleMap[[max: size]];
bitmapAsPixelArray: ImagerPixelArray.PixelArray ¬ ImagerPixelArray.FromPixelMap[pixelMap: ImagerPixel.MakePixelMap[bitmap], box: ImagerSample.GetBox[bitmap], scanMode: scanMode, immutable: FALSE];
pixelsToMeters: Transformation = ImagerBackdoor.GetTransformation[context: bitmapContext, from: device, to: client];
ImagerPrintContext.SetBitmap[context: bitmapContext, bitmap: bitmap];
ImagerPrintContext.SetSeparation[bitmapContext, black];
FOR i:
INT
IN [1..input.pages]
DO
PageAction:
PROC [context: Imager.Context] ~ {
Imager.ConcatT[context, pixelsToMeters];
Imager.SetPriorityImportant[context, FALSE];
Imager.MaskPixel[context: context, pa: XeroxCompress.CompressPixelArray[bitmapAsPixelArray]]
};
Process.CheckForAbort[];
ImagerSample.Clear[bitmap];
InterpressInterpreter.DoPage[master: input, page: i, context: bitmapContext, log: Log];
Process.CheckForAbort[];
ImagerInterpress.DoPage[output, PageAction, 1];
Process.CheckForAbort[];
ENDLOOP;
ImagerInterpress.Close[output];
InterpressInterpreter.Close[input];
cmd.out.PutRope[Rope.Concat[outName, "\n"]];
};