Example #1
0
        public virtual void testCopyNodeData()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType(EnumType.Product);
            JDFNode n1 = n = n.addJDFNode(EnumType.BlockPreparation);

            n1.setAttribute("foo:bar", "fnarf", "www.foobar.com");

            JDFDoc          dA = new JDFDoc("JDF");
            JDFAncestorPool ap = dA.getJDFRoot().appendAncestorPool();

            ap.appendAncestor().setNodeID(n1.getID());
            ap.copyNodeData(n, true, true, false);
            JDFAncestor a0 = ap.getAncestor(0);

            Assert.AreEqual("fnarf", a0.getAttribute("foo:bar"));
            Assert.AreEqual(n1.getID(), a0.getNodeID());
            string    s    = dA.write2String(2);
            JDFParser p    = new JDFParser();
            JDFDoc    test = p.parseString(s);

            Assert.IsNotNull(test);
        }
Example #2
0
        public void testAmpersand()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType("Interpreting", true);
            JDFFileSpec fs  = (JDFFileSpec)n.addResource(ElementName.FILESPEC, null, EnumUsage.Input, null, null, null, null);
            string      url = "FileInfo:///a&b.pdf";

            fs.setURL(url);
            string s = d.write2String(2);

            JDFParser p      = new JDFParser();
            JDFDoc    dNew   = p.parseString(s);
            string    newUrl = ((JDFFileSpec)dNew.getJDFRoot().getResourcePool().getElement(ElementName.FILESPEC, null, 0)).getURL();

            Assert.AreEqual(newUrl, url, "url=url");
        }
Example #3
0
        public void testStitchType()
        {
            JDFDoc          doc     = new JDFDoc("JDF");
            JDFNode         root    = doc.getJDFRoot();
            JDFResourcePool resPool = root.getCreateResourcePool();
            KElement        kElem   = resPool.appendResource(ElementName.STITCHINGPARAMS, null, null);

            Assert.IsTrue(kElem is JDFStitchingParams);
            JDFStitchingParams sp = (JDFStitchingParams)kElem;

            sp.setStitchType(EnumStitchType.Saddle);
            string write2String = doc.write2String(0);

            Assert.IsTrue(write2String.IndexOf("StitchType=\"Saddle\"") > 22);
            JDFParser p2 = new JDFParser();
            JDFDoc    d2 = p2.parseString(write2String);

            Assert.IsTrue(d2.write2String(0).IndexOf("StitchType=\"Saddle\"") > 22);
        }
Example #4
0
        public virtual void testTaggedAutomatedBooklet()
        {
            n.setXMLComment("This is a simple Automated Booklet using negative ords and meta data tags\n" + "New Attribute @OrdsConsumed limits the number of ords consumed by an automated Layout\n" + "Negative Ord values are assumed to flow backwards\n" + "New Attribute @OrdReset defines the scope of ords\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");

            n.setType(EnumType.Combined);
            n.setTypes(new VString("Interpreting Rendering DigitalPrinting Inserting Stitching", null));
            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is any RunList...");
            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            JDFMedia media        = (JDFMedia)n.addResource("Media", EnumUsage.Input);
            JDFMedia mediaC       = (JDFMedia)media.addPartition(EnumPartIDKey.SheetName, "TheCover");
            JDFMedia mediaCMale   = (JDFMedia)mediaC.addPartition(EnumPartIDKey.SetTags, "Male");
            JDFMedia mediaCFemale = (JDFMedia)mediaC.addPartition(EnumPartIDKey.SetTags, "Female");

            JDFComponent insert = (JDFComponent)n.addResource("Component", null, EnumUsage.Input, EnumProcessUsage.Child, null, null, null);

            // JDFComponent insertExist=(JDFComponent)
            insert.addPartition(EnumPartIDKey.DocTags, "Exist");
            // JDFComponent insertProspect=(JDFComponent)
            insert.addPartition(EnumPartIDKey.DocTags, "Prospect");

            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheCover");

            cover.setAutomated(false);
            JDFLayout coverMale = (JDFLayout)cover.addPartition(EnumPartIDKey.SetTags, "Male");

            coverMale.refMedia(mediaCMale);
            JDFLayout coverMaleHi = (JDFLayout)coverMale.addPartition(EnumPartIDKey.PageTags, "Hi");
            JDFLayout coverMaleLo = (JDFLayout)coverMale.addPartition(EnumPartIDKey.PageTags, "Low");

            JDFLayout coverFemale = (JDFLayout)cover.addPartition(EnumPartIDKey.SetTags, "Female");

            coverFemale.refMedia(mediaCFemale);
            JDFLayout coverFemaleHi = (JDFLayout)coverFemale.addPartition(EnumPartIDKey.PageTags, "Hi");
            JDFLayout coverFemaleLo = (JDFLayout)coverFemale.addPartition(EnumPartIDKey.PageTags, "Low");

            JDFLayout[] lo4 = new JDFLayout[4];
            lo4[0] = coverMaleHi;
            lo4[1] = coverFemaleHi;
            lo4[2] = coverMaleLo;
            lo4[3] = coverFemaleLo;
            JDFContentObject co;

            for (int i = 0; i < 4; i++)
            {
                JDFLayout lolo = lo4[i];

                JDFLayout coverFront = (JDFLayout)lolo.addPartition(EnumPartIDKey.Side, "Front");

                co = coverFront.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(0);
                co.setDescriptiveName("Front Cover Page Outside");
                co = coverFront.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 8.5 * 72, 0, 0));
                co.setOrd(-1);
                co.setDescriptiveName("Back Cover Page Outside");
                if (i < 2)
                {
                    JDFLayout coverBack = (JDFLayout)lolo.addPartition(EnumPartIDKey.Side, "Back");
                    co = coverBack.appendContentObject();
                    co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                    co.setOrd(0);
                    co.setDescriptiveName("Front Cover Page Inside");
                    co = coverBack.appendContentObject();
                    co.setCTM(new JDFMatrix(1, 0, 0, 8.5 * 72, 0, 0));
                    co.setOrd(-1);
                    co.setDescriptiveName("Back Cover Page Inside");
                }
            }
            JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheSheet");

            sheet.setAutomated(true);
            sheet.setAttribute("OrdReset", "Set Doc");
            sheet.setAttribute("OrdsConsumed", "0 -1");
            sheet = (JDFLayout)sheet.addPartition(EnumPartIDKey.SetTags, "Male Female").addPartition(EnumPartIDKey.PageTags, "Hi Lo");
            JDFLayout sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front);

            co = sheetFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrd(0);
            co.setDescriptiveName("Front left Page 0,2,4...");

            co = sheetFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(-1);
            co.setDescriptiveName("Back right page after folding -1 -3 -5 ... (Front sheet)");

            JDFLayout sheetBack = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Back);

            co = sheetBack.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(1);
            co.setDescriptiveName("Back left Page 1,3,5");

            co = sheetBack.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrd(-2);
            co.setDescriptiveName("Front Right Page Page -2 -4 -6");
            string s = doc.write2String(2);

            s = StringUtil.replaceString(s, "SetTags", "Meta0");
            s = StringUtil.replaceString(s, "DocTags", "Meta1");
            s = StringUtil.replaceString(s, "PageTags", "Meta2");

            FileInfo f  = new FileInfo(sm_dirTestDataTemp + "TaggedAutomatedBooklet.jdf");
            Stream   os = new FileStream(f.FullName, FileMode.Append);

            byte[] ba = Encoding.ASCII.GetBytes(s);
            os.Write(ba, 0, ba.Length);
        }