//--------------------------------------------------------------------// // C o n s t r u c t o r // // P C L O r i e n t a t i o n // // // //--------------------------------------------------------------------// public PCLOrientation(PCLOrientations.eAspect aspect, String name, Byte idPCL, Byte idPCLXL) { _orientationAspect = aspect; _orientationName = name; _orientationIdPCL = idPCL; _orientationIdPCLXL = idPCLXL; }
//--------------------------------------------------------------------// // M e t h o d // // g e t P a p e r W i d t h // //--------------------------------------------------------------------// // // // Return the width of the paper for a given aspect. // // // //--------------------------------------------------------------------// public UInt16 getPaperWidth(UInt16 sessionUPI, PCLOrientations.eAspect aspect) { if (aspect == PCLOrientations.eAspect.Portrait) { return((UInt16)((_sizeShortEdge * sessionUPI) / _sizeUnitsPerInch)); } else { return((UInt16)((_sizeLongEdge * sessionUPI) / _sizeUnitsPerInch)); } }
//--------------------------------------------------------------------// // M e t h o d // // g e t L o g i c a l O f f s e t // //--------------------------------------------------------------------// // // // Return the logical page offset of the paper for a given aspect. // // // //--------------------------------------------------------------------// public UInt16 getLogicalOffset(UInt16 sessionUPI, PCLOrientations.eAspect aspect) { if (aspect == PCLOrientations.eAspect.Portrait) { return((UInt16)((_marginsLogicalPort * sessionUPI) / _sizeUnitsPerInch)); } else { return((UInt16)((_marginsLogicalLand * sessionUPI) / _sizeUnitsPerInch)); } }
//--------------------------------------------------------------------// // M e t h o d // // g e t L o g P a g e W i d t h // //--------------------------------------------------------------------// // // // Return the width of the PCL logical page for a given aspect. // // // //--------------------------------------------------------------------// public UInt16 getLogPageWidth(UInt16 sessionUPI, PCLOrientations.eAspect aspect) { if (aspect == PCLOrientations.eAspect.Portrait) { return((UInt16)(((_sizeShortEdge - (_marginsLogicalPort * 2)) * sessionUPI) / _sizeUnitsPerInch)); } else { return((UInt16)(((_sizeLongEdge - (_marginsLogicalPort * 2)) * sessionUPI) / _sizeUnitsPerInch)); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e J o b // //--------------------------------------------------------------------// // // // Generate test data. // // // // Some sequences are built up as (Unicode) strings, then converted // // to byte arrays before writing out - this works OK because all the // // characters we're using are within the ASCII range (0x00-0x7f) and // // are hence represented using a single byte in the UTF-8 encoding. // // // //--------------------------------------------------------------------// public static void generateJob(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Int16 logLeftOffset, Int16 logTopOffset, UInt16 logPageWidth, UInt16 logPageHeight, Boolean formAsMacro, Boolean incStdPage) { const PCLOrientations.eAspect aspectPort = PCLOrientations.eAspect.Portrait; PCLOrientations.eAspect aspect; UInt16 paperWidth, paperLength, paperLengthPort, logXOffset; //----------------------------------------------------------------// aspect = PCLOrientations.getAspect(indxOrientation); paperLength = PCLPaperSizes.getPaperLength(indxPaperSize, _unitsPerInch, aspect); paperWidth = PCLPaperSizes.getPaperWidth(indxPaperSize, _unitsPerInch, aspect); logXOffset = PCLPaperSizes.getLogicalOffset(indxPaperSize, _unitsPerInch, aspect); paperLengthPort = PCLPaperSizes.getPaperLength(indxPaperSize, _unitsPerInch, aspectPort); //----------------------------------------------------------------// aspect = PCLOrientations.getAspect(indxOrientation); logXOffset = PCLPaperSizes.getLogicalOffset(indxPaperSize, _unitsPerInch, aspect); //----------------------------------------------------------------// generateJobHeader(prnWriter, indxPaperSize, indxPaperType, indxOrientation, formAsMacro, paperWidth, paperLength, logXOffset); generatePageSet(prnWriter, indxPaperSize, indxPaperType, indxOrientation, formAsMacro, incStdPage, paperWidth, paperLength, logXOffset, logLeftOffset, logTopOffset, logPageWidth, logPageHeight); generateJobTrailer(prnWriter, formAsMacro); }