示例#1
0
        public virtual void testGeneratedObject()
        {
            n = doc.getJDFRoot();
            JDFLayout  lo  = (JDFLayout)n.addResource("Layout", null, EnumUsage.Input, null, null, null, null);
            JDFRunList rlo = (JDFRunList)n.addResource("RunList", null, EnumUsage.Output, null, null, null, null);

            rlo.setFileURL("output.pdf");

            lo.appendXMLComment("This is a simple horizontal slug line\nAnchor specifies which of the 9 coordinates is the 0 point for the coordinate system specified in the CTM\nThis slugline describes error and endtime in the lower left corner of the scb", null);
            JDFMarkObject mark = lo.appendMarkObject();

            mark.setCTM(new JDFMatrix("1 0 0 1 0 0"));
            JDFJobField jf = mark.appendJobField();

            jf.setShowList(new VString("Error EndTime", " "));

            lo.appendXMLComment("This is a simple vertical slug line\nAnchor specifies which of the 9 coordinates is the 0 point for the coordinate system specified in the CTM\nThis slugline describes the operator name along the right side of the sheet text from top to bottom\nthe slug line (top right of the slug cs) is anchored in the bottom right of the sheet.\nNote that the coordinates in the ctm are guess work. the real coordinates are left as an exercise for the reader;-)", null);
            mark = lo.appendMarkObject();
            mark.setCTM(new JDFMatrix("0 1 -1 0 555 444"));
            jf = mark.appendJobField();
            jf.setShowList(new VString("Operator", " "));
            JDFDeviceMark dm = jf.appendDeviceMark();

            dm.setAttribute("Anchor", "TopRight");
            dm.setFont("Arial");
            dm.setFontSize(10);

            lo.appendXMLComment("This is a formatted vertical slug line\nAnchor specifies which of the 9 coordinates is the 0 point for the coordinate system specified in the CTM\nThis slugline describes a formatted line along the left side of the sheet text from top to bottom\nthe slug line (top left) is anchored in the bottom left of the sheet.\nThe text is defined in @Format with the sequence in ShowList defining the 5 placeholders marked by %s or %i\nAn example instance would be: \"This Cyan plate of Sheet1 was proudly produced by Joe Cool! Resolution: 600 x 600\"\nNote that the coordinates in the ctm are guess work. the real coordinates are left as an exercise for the reader;-)", null);
            mark = lo.appendMarkObject();
            mark.setCTM(new JDFMatrix("0 1 -1 0 0 0"));
            jf = mark.appendJobField();
            jf.setShowList(new VString("Separation SheetName Operator ResolutionX ResolutionY", " "));
            jf.setAttribute("Format", "This %s plate of %s was proudly produced by %s!\nResolution: %i x %i");
            dm = jf.appendDeviceMark();
            dm.setAttribute("Anchor", "TopLeft");
            dm.setFont("Arial");
            dm.setFontSize(10);

            lo.appendXMLComment("This is a positioned registermark\nthe center of the mark is translated by 666 999\n the JobField is empty and serves aa a Marker that no external Content is requested", null);
            mark = lo.appendMarkObject();
            mark.setCTM(new JDFMatrix("1 0 0 1 666 999"));
            jf = mark.appendJobField();
            mark.appendXMLComment("The coordinate system origin is defined by the anchor in the center, i.e. 0 0\n the separartions are excluding black", null);
            JDFRegisterMark rm = mark.appendRegisterMark();

            rm.setMarkType("Arc Cross");
            rm.setMarkUsage(EnumMarkUsage.Color);
            rm.setCenter(new JDFXYPair("0 0"));
            rm.setSeparations(new VString("Cyan Magent Yellow", " "));
            dm = jf.appendDeviceMark();
            dm.setAttribute("Anchor", "Center");

            doc.write2File(sm_dirTestDataTemp + "generatedObject.jdf", 2, false);
        }
示例#2
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);
        }