From: <doc...@us...> - 2007-07-26 20:48:40
|
Revision: 130 http://openpcl.svn.sourceforge.net/openpcl/?rev=130&view=rev Author: documentsystems Date: 2007-07-26 13:48:42 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Howard Hoagland. In PosPrintPages, in addPclBytesForPrintingFormNames(), added code to adjust higher the Y location of the Form Name at the bottom of the page of Legal pages shrunk to fit on Letter paper, and adjust lower to go to the bottom of the page for Letter pages printed on Legal paper. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-26 18:33:23 UTC (rev 129) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-26 20:48:42 UTC (rev 130) @@ -439,35 +439,62 @@ if (pFormName == null || pFormName.length() < 1) { return; } final int tNumPixelsFromPageEdge = 210; + final int tNumPixelsFromPageEdgeWhenShrinkLegalOnLetter = 230; + final int tYPosForLetterPortrait = (300 * 11) - tNumPixelsFromPageEdge; final int tYPosForLegalPortrait = (300 * 14) - tNumPixelsFromPageEdge; + final int tYPosForLegalPortraitWhenShrinkToLetter = (300 * 14) - tNumPixelsFromPageEdgeWhenShrinkLegalOnLetter; final int tYPosforLetterOrLegalLandscape =(int)(Math.round(300 * 8.5d) - tNumPixelsFromPageEdge); - // Default to Legal Portrait Y position - int tYPosForFormName = tYPosForLegalPortrait; - + // Default to Letter Portrait Y position + int tYPosForFormName = tYPosForLetterPortrait; + + // Set the Y position for where to put the Form Name depending on 3 things: + // 1. Portrait/Landcape + // 2. Letter/Legal + // 3. Print all on Letter/Legal if (pPageOrientation == sPageOrientationPortrait) { - if (pLetterOrLegal.equalsIgnoreCase("LTR")) { - tYPosForFormName = tYPosForLetterPortrait; + // Here for Portrait + if (pLetterOrLegal.equalsIgnoreCase("LGL")) { + // Here for Portrait and Legal + if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal()) { + // Here for Portrait and Legal and Print all on Letter (shrink Legal) + tYPosForFormName = tYPosForLegalPortraitWhenShrinkToLetter; + } else { + // Here for Portrait and Legal + tYPosForFormName = tYPosForLegalPortrait; + } + + } else if (pLetterOrLegal.equalsIgnoreCase("LTR")) { + // Here for Portrait and Letter + if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // Here for Portrait and Letter and Print all on Legal + tYPosForFormName = tYPosForLegalPortrait; + } else { + // Here for Portrait and Letter + tYPosForFormName = tYPosForLetterPortrait; + } } } else if (pPageOrientation == sPageOrientationLandscape) { + // Here for Landscape. There's only one condition for now. If Landscape is implemented later, then add more here tYPosForFormName = tYPosforLetterOrLegalLandscape; } - - try { - pBaos.write(tFormNameFont); - pBaos.write(sbESC); - pBaos.write('*'); - pBaos.write('p'); - pBaos.write('0'); - pBaos.write('x'); - pBaos.write(String.valueOf(tYPosForFormName).getBytes()); - pBaos.write('Y'); // Cursor position to (x,y) using ESC * p 0 x 123 Y - pBaos.write(pFormName.getBytes()); - pBaos.write(tDefaultCourierFont); - } catch (IOException e) { - PriDebug.releaseln("In PosPrintPages, can't write Form Name into ByteArrayOutputStream"); - } + + // Save the PCL bytes needed to select the font, do (x,y) positioning, put the form name, reset the font to default + try { + pBaos.write(tFormNameFont); + pBaos.write(sbESC); + pBaos.write('*'); + pBaos.write('p'); + pBaos.write('0'); + pBaos.write('x'); + pBaos.write(String.valueOf(tYPosForFormName).getBytes()); + pBaos.write('Y'); // Cursor position to (x,y) using ESC * p 0 x 123 Y + pBaos.write(pFormName.getBytes()); + pBaos.write(tDefaultCourierFont); + } catch (IOException e) { + PriDebug.releaseln("In PosPrintPages, can't write Form Name into ByteArrayOutputStream"); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |