public virtual void testCutAndStack() { n.setXMLComment("This is a simple cut and stack layout witrh 2 stacks of one page each (two sided)\n"); setUpAutomatedInputRunList(); rl.setDescriptiveName("This is any RunList..."); lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); lo.setResStatus(EnumResStatus.Available, true); lo.setMaxOrd(2); lo.setAutomated(true); lo.setXMLComment("2 stacks with 2 pages\n" + "The algorithm for calculating which pages go where is:\n" + "Ord + MaxOrd*SheetLoop%(MaxOrd*MaxStack*StackDepth) + StackOrd*StackDepth\n" + "Each set of stacks consumes 2 * 2 * 100 = 400 Pages (4 ContentObjects = 2 front, 2 Back / Sheet * 100 StackDepth"); lo.setAttribute("StackDepth", "100"); lo.setAttribute("MaxStack", "2"); JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheSheet"); JDFLayout coverFront = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Front); JDFContentObject co = coverFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); co.setAttribute("StackOrd", "0"); co.setDescriptiveName("Front Page 0,2,4...0, Stack 0"); co.setXMLComment("this co consumes all pages 0,2,4...198, 400,402,404...598, 800...."); co = coverFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0)); co.setOrd(0); co.setAttribute("StackOrd", "1"); co.setDescriptiveName("Front Page 0,2,4,...0, Stack 1"); co.setXMLComment("this co consumes all pages 200,202,204...398, 600,602,604...798, 1000...."); JDFLayout coverBack = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Back); co = coverBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0)); co.setOrd(1); co.setAttribute("StackOrd", "0"); co.setDescriptiveName("Back Page 1,3,5, Stack 0"); co.setXMLComment("this co consumes all pages 1,3,5...199, 401,403,405...499, 801...."); co = coverBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(1); co.setAttribute("StackOrd", "1"); co.setDescriptiveName("Back Page 1,3,5, Stack 1"); co.setXMLComment("this co consumes all pages 201,203,205...299, 601,603,605...799, 1001...."); doc.write2File(sm_dirTestDataTemp + "CutStack.jdf", 2, false); }
public virtual void testDynamicMarks() { JDFElement.setLongID(false); JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); lo.setXMLComment("Layout that illustrates dynamic mark placement - all margins are 25 points (gutter=2*25)"); lo.setSurfaceContentsBox(new JDFRectangle(0, 0, 500, 350)); JDFSheet s = lo.appendSheet(); JDFSurface su = s.appendFrontSurface(); JDFContentObject co0 = su.appendContentObject(); co0.setOrd(0); JDFMatrix m1 = (JDFMatrix)JDFMatrix.unitMatrix.Clone(); m1.shift(25, 25); co0.setCTM(JDFMatrix.unitMatrix); co0.setTrimSize(new JDFXYPair(200, 300)); string[] id = new string[2]; id[0] = co0.appendAnchor(null); JDFContentObject co1 = su.appendContentObject(); m1 = (JDFMatrix)JDFMatrix.unitMatrix.Clone(); m1.shift(275, 25); co1.setCTM(m1); co1.setTrimSize(200, 300); id[1] = co1.appendAnchor(null); { JDFMarkObject mark0 = su.appendMarkObject(); mark0.setXMLComment("Register Mark on the top right of the sheet - assumed size is 20*30, assumed sheet size is 500*350"); mark0.setTrimSize(20, 30); mark0.setCTM(new JDFMatrix(1, 0, 0, 1, 500 - 20, 350 - 30)); mark0.appendDeviceMark().setAttribute("Anchor", "TopRight"); mark0.appendRegisterMark().setXMLComment("mark metadata goes here"); appendRefAnchor(mark0, "TopRight", "Parent", null); } { JDFMarkObject mark0 = su.appendMarkObject(); mark0.setXMLComment("Vertical Slug Line beginning at the top of the bottom margin of of the sheet between the 2 pages" + "\nnote that no TrimSize need be specified and therefore TrimCTM / CTM place the point defined by @Anchor" + "\nnote also that the anchor points to centerleft which is in the unrotated (horizontal) cs of the slug line"); JDFMatrix m0 = new JDFMatrix(1, 0, 0, 1, 0, 0); m0.rotate(90); m0.shift(250, 25); mark0.setCTM(m0); JDFDeviceMark dm = mark0.appendDeviceMark(); dm.setAttribute("Anchor", "CenterLeft"); dm.setFontSize(10); dm.setFont("GhostCrypt"); JDFJobField jf = mark0.appendJobField(); jf.setXMLComment("Result: Sheet Printed by Dracula at the moonphase FullMoon"); jf.setAttribute("JobFormat", "Sheet Printed by %s at the moonphase %s"); jf.setAttribute("JobTemplate", "Operator,MoonPhase"); appendRefAnchor(mark0, "BottomCenter", "Parent", null); } for (int i = 0; i < 2; i++) { JDFMarkObject mark0 = su.appendMarkObject(); mark0.setXMLComment("Horizonzal Slug Line, centered 5 points over the top of page " + i + "\nnote that page is not yet a predefined token\n"); JDFMatrix m0 = new JDFMatrix(1, 0, 0, 1, 0, 0); m0.rotate(90); m0.shift(25 + 100, 300 + 25 + 5); if (i == 1) { m0.shift(250, 0); } mark0.setCTM(m0); JDFDeviceMark dm = mark0.appendDeviceMark(); dm.setAttribute("Anchor", "BottomCenter"); dm.setFontSize(8); JDFJobField jf = mark0.appendJobField(); jf.setXMLComment("Result: Page # " + i + " for Customer, Polanski - Job: J11"); jf.setAttribute("JobFormat", "Page # %i for Customer, %s - Job: %s"); jf.setAttribute("JobTemplate", "Page,JobRecipientName,JobID"); appendRefAnchor(mark0, "BottomCenter", "Sibling", id[i]); } doc.write2File(sm_dirTestDataTemp + "LayoutDynamicMarks.jdf", 2, false); }
public virtual void testAutomatedBookletWithCover() { for (int j = 0; j < 2; j++) { for (int i = 0; i < 3; i++) { if (i == 2 && j == 1) { continue; // no cut&stack centerfold } reSetUp(); n.setXMLComment("This is a simple Automated Booklet using negative ords and special handling oft the cover\n" + "New Attribute @OrdsConsumed limits the number of ords consumed by an automated Layout\n" + "Negative Ord values are assumed to flow backwards\n" + "MaxOrd is not specified and must be calculated by counting the number of different ord values\n" + "If we want to keep maxord, it would have to be replaced by an xypair that specifies hom many are consumed from back and from front\n" + "If the number of pages is not mod 4, blank pages are retained at the back of the layout"); setUpAutomatedInputRunList(); rl.setDescriptiveName("This is any RunList..."); lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); lo.setResStatus(EnumResStatus.Available, true); if (j > 0) { lo.setAttribute("StackDepth", 100, null); } JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheCover"); cover.setAutomated(false); JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheSheet"); sheet.setAutomated(true); JDFLayout coverFront = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Front); JDFContentObject co; if (i == 0) { cover.setXMLComment("the cover consumes pages 0 and -1 and is not printed on the inside=back"); for (int k = 0; k < 1 + j; k++) { co = coverFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, k * 1000)); co.setOrd(0); co.setDescriptiveName("Front left cover Page 0..."); if (j > 0) { co.setAttribute("StackOrd", k, null); } co = coverFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, k * 1000)); co.setOrd(-1); co.setDescriptiveName("Back right cover page after folding -1 "); if (j > 0) { co.setAttribute("StackOrd", k, null); } } sheet.setAttribute("OrdsConsumed", "1 -2"); } else if (i == 1) { cover.setXMLComment("the cover consumes page 0 as a wraparound and is not printed on the inside=back"); for (int k = 0; k < j; k++) { co = coverFront.appendContentObject(); co.setDescriptiveName("wraparound cover Page 0"); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, k * 1000)); co.setOrd(0); if (j > 0) { co.setAttribute("StackOrd", k, null); } } sheet.setAttribute("OrdsConsumed", "1 -1"); } else if (i == 2) { cover.setXMLComment("the cover consumes page 0 as a wraparound and is not printed on the inside=back"); co = coverFront.appendContentObject(); co.setDescriptiveName("wraparound cover Page 0"); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); sheet.setAttribute("OrdsConsumed", "1 -5"); JDFLayout centerfold = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Centerfold"); centerfold.setAutomated(true); centerfold.setXMLComment("the cetertfold is an asymmetric z-fold that consumes 1 large page on the front and 3 pages on the back"); centerfold.setAttribute("OrdsConsumed", "-4 -1"); co = ((JDFLayout)centerfold.addPartition(EnumPartIDKey.Side, "Front")).appendContentObject(); co.setDescriptiveName("centerfold front spread"); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); centerfold = (JDFLayout)centerfold.addPartition(EnumPartIDKey.Side, "Back"); for (int k = 0; k < 3; k++) { co = centerfold.appendContentObject(); co.setDescriptiveName("centerfold back page " + (k + 1)); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, k * 1000)); co.setOrd(k + 1); } } sheet.setXMLComment("this sheet consumes the second through " + (-2 + i) + " pages\nAutomated ords are based on the REDUCED list defined by OrdsConsumed\n" + "In this case ord=0 actually starts at ord(RunList)=1 and ord -1 actually starts at ord(RunList -2)\n" + "The advantage is that the offsets for the loop are specified in OrdsConsumed while the loop increments are specified in the ords:\n" + "Ord RL (++) = OrdsConsumed_x + Ord + n*maxOrd_x\n" + "Ord RL (--) = 1+ OrdsConsumed_y + Ord - n*maxOrd_y (the first 1 in the equation is from the fact that -1+-1 is actually still -1)\n"); JDFLayout sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front); JDFLayout sheetBack = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Back); for (int k = 0; k <= j; k++) { co = sheetFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, k * 1000)); co.setOrd(0); if (j > 0) { co.setAttribute("StackOrd", k, null); } co.setDescriptiveName("Front left Pages "); co = sheetFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, k * 1000)); co.setOrd(-1); co.setDescriptiveName("Back right pages after folding ... (Front sheet)"); if (j > 0) { co.setAttribute("StackOrd", k, null); } co = sheetBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, k * 1000)); co.setOrd(1); co.setDescriptiveName("Back left Pages"); if (j > 0) { co.setAttribute("StackOrd", k, null); } co = sheetBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, k * 1000)); co.setOrd(-2); co.setDescriptiveName("Front Right Page Pages"); if (j > 0) { co.setAttribute("StackOrd", k, null); } } doc.write2File(sm_dirTestDataTemp + "SimpleAutomatedBookletWithCover" + i + "_" + j + ".jdf", 2, false); } } }