Esempio n. 1
0
        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);
        }