Exemple #1
0
        ///
        ///	 <summary> *  </summary>
        ///
        private void executeLayout()
        {
            JDFLayout lo = (JDFLayout)theExpandedNode.getResource(ElementName.LAYOUT, EnumUsage.Output, 0);

            if (lo != null && vParts != null)
            {
                VJDFAttributeMap reducedMap = getReducedMap(new VString("Separation PartVersion", " "));
                lo.setResStatus(EnumResStatus.Available, true);
                if (reducedMap != null)
                {
                    int size = reducedMap.Count;
                    for (int i = 0; i < size; i++)
                    {
                        JDFAttributeMap part = reducedMap[i];
                        if (bSingleSided == true && "Back".Equals(part.get("Side")))
                        {
                            continue;
                        }

                        JDFLayout partLO = (JDFLayout)lo.getCreatePartition(part, partIDKeys);
                        for (int j = 0; j < 4; j++)
                        {
                            JDFContentObject co = partLO.appendContentObject();
                            co.setCTM(new JDFMatrix(1 + 10 * j, 2 + 20 * j, 3 + 30 * j, 4 + 40 * j, 5 + 50 * j, 6 + 0 * j));
                            co.setOrd(j + i * 4);
                        }
                    }
                }
            }
        }
        public virtual void testAutomateLayout1()
        {
            n.setXMLComment("This is the simplest example of an automated layout\n" + "The structure is aligned as closely as possible with a static Layout\n" + "note that the actual processes and outputs have been omitted for brevity");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is a RunList specifiying 100 instance documents of 14 pages each in a ppml file");

            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            lo.setMaxOrd(14);
            lo.setMaxDocOrd(1);
            lo.setAutomated(true);
            lo.appendXMLComment("Layout for 2 Cover pages and 12 2 up two sided body pages\n The number of pages per instance document is fixed\n" + "This Layout is an example of an 'almost conventional' automated layout\n" + "MaxDocOrd is set to 1. This is redundant since 1 is the default.\n" + "A value of 1 explicitly resets all counters at a Document break.", null);
            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Cover");

            cover.setDescriptiveName("one sided cover - the inner = back side is empty");
            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(13);
            co.setDescriptiveName("Front Cover Page");
            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(0);
            co.setDescriptiveName("Back Cover Page - (back of brochure but front of sheet)");

            for (int i = 0; i < 3; i++)
            {
                JDFLayout body = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Body" + (i + 1));
                body.setDescriptiveName("sheet " + (i + 1) + " of 3 of the insert");
                JDFLayout bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Front);

                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(8 + 2 * (2 - i));
                co.setDescriptiveName("Left Front Sheet Body Page");
                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(1 + (2 * i));
                co.setDescriptiveName("Right Front Sheet Body Page");

                bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Back);

                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(2 + (2 * i));
                co.setDescriptiveName("Left Back Sheet Body Page");
                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(7 + 2 * (2 - i));
                co.setDescriptiveName("Right Back Sheet Body Page");
            }
            doc.write2File(sm_dirTestDataTemp + "AutomatedLayout1.jdf", 2, false);
        }
        public virtual void testAutomateLayout2()
        {
            n.setXMLComment("This another example of an automated layout\n" + "The structure is aligned close to a static Layout but additionally uses OrdExpression and allows for varying numbers of pages in the runlist\n" + "note that the actual processes and outputs have been omitted for brevity");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is a RunList specifiying 100 instance documents of varying pages each in a ppml file");

            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            lo.setMaxDocOrd(1);
            lo.setAutomated(true);
            lo.appendXMLComment("Layout for 2 Cover pages and varying numbers of 2 up two sided body pages\n" + "The number of pages per instance document varies\n" + "MaxDocOrd is set to 1. This is redundant since 1 is the default.\n" + "A value of 1 explicitly resets all counters at a Document break.", null);
            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Cover");

            cover.appendXMLComment("In this example, the cover is assumed to be the first two pages of each runlist\n" + "\n!!! We unfortunately have an issue here:\n" + "we cannot differentiate whether the cover should be repeated of not, i.e. whether the cover is executed once (the correct choice) or repeated between each body sheet.\n" + "Note that no MaxOrd is not set, as it varies between documents", null);
            cover.setDescriptiveName("one sided cover - the inner = back side is empty");
            JDFLayout        coverFront = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Front);
            JDFContentObject co         = coverFront.appendContentObject();

            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrdExpression("1");
            co.setDescriptiveName("Front Cover Page");
            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrdExpression("0");
            co.setDescriptiveName("Back Cover Page - (back of brochure but front of sheet)");

            JDFLayout body = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Body");

            body.setDescriptiveName("abstract description of multiple body sheets");
            JDFLayout bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Front);

            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrdExpression("4 * (n+3)/4 - s*2 +1");
            co.setDescriptiveName("Left Front Sheet Body Page");
            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrdExpression("2*s +2");
            co.setDescriptiveName("Right Front Sheet Body Page");

            bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Back);

            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrdExpression("2*s +3");
            co.setDescriptiveName("Left Back Sheet Body Page");
            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrdExpression("4 * (n+3)/4 - s*2 +0");
            co.setDescriptiveName("Right Back Sheet Body Page");

            doc.write2File(sm_dirTestDataTemp + "AutomatedLayout2.jdf", 2, false);
        }
Exemple #4
0
        ///
        ///	 <summary> *  </summary>
        ///
        private void initOutputLayout()
        {
            JDFLayout lo = (JDFLayout)theNode.getCreateResource(ElementName.LAYOUT, EnumUsage.Output, 0);

            lo.setResStatus(EnumResStatus.Unavailable, false);
            VString vSigSheetSide = new VString("SignatureName SheetName Side", null);

            lo.setPartIDKeys(vSigSheetSide);
            for (int i = 0; i < vParts.Count; i++)
            {
                lo.getCreatePartition(vParts[i], vSigSheetSide);
            }
        }
        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 testAutomateLayout4()
        {
            n.setXMLComment("This is a simple example of an automated layout that positions multiple instance documents onto one sheet\n" + "The structure is aligned as closely as possible with a static Layout\n" + "note that the actual processes and outputs have been omitted for brevity");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is a RunList specifiying 100 instance documents of 14 pages each in a ppml file.\n" + "DocCopies requests a repeat of 50 copies per document");
            rl.setAttribute("DocCopies", 50, null);
            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            lo.setMaxOrd(1);
            lo.setMaxDocOrd(4);
            lo.setAutomated(true);
            lo.appendXMLComment("Layout for 4stacks on a sheet\n The number of pages per instance document is fixed\n" + "\n", null);
            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Stack");

            cover.setDescriptiveName("one sided 4 up stack back side is empty");
            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.setDocOrd(0);
            co.setDescriptiveName("Front Cover Page, document 0,4,...");

            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(0);
            co.setDocOrd(1);
            co.setDescriptiveName("Front Cover Page, document 1,5,...");

            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 11 * 72));
            co.setOrd(0);
            co.setDocOrd(2);
            co.setDescriptiveName("Front Cover Page, document 2,6,...");

            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 11 * 72));
            co.setOrd(0);
            co.setDocOrd(3);
            co.setDescriptiveName("Front Cover Page, document 3,7,...");

            doc.write2File(sm_dirTestDataTemp + "AutomatedLayout4.jdf", 2, false);
        }
        public virtual void testAutomatedBooklet1()
        {
            n.setXMLComment("This is a simple Automated Booklet using negative ords\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);

            JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheSheet");

            sheet.setAutomated(true);
            sheet.setAttribute("OrdsConsumed", "0 -1");
            JDFLayout        sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front);
            JDFContentObject 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");

            doc.write2File(sm_dirTestDataTemp + "SimpleAutomatedBooklet.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);
                }
            }
        }
        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);
        }
Exemple #10
0
        public virtual void testAutomateLayout3()
        {
            n.setXMLComment("This is a simple example of an automated layout that positions multiple instance documents onto one sheet\n" + "The structure is aligned as closely as possible with a static Layout\n" + "note that the actual processes and outputs have been omitted for brevity");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is a RunList specifiying 100 instance documents of 14 pages each in a ppml file");

            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            lo.setMaxOrd(7);
            lo.setMaxDocOrd(2);
            lo.setAutomated(true);
            lo.appendXMLComment("Layout for 2*1 Cover page and 2*6 2 up two sided body pages\n The number of pages per instance document is fixed\n" + "This Layout is an example of an 'almost conventional' automated layout\n" + "MaxDocOrd is set to 2. Thus 2 documents are positioned on each sheet.\n", null);
            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Cover");

            cover.setDescriptiveName("one sided cover - the inner = back side is empty");
            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.setDocOrd(0);
            co.setDescriptiveName("Front Cover Page, document 0,2,4,...");
            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(0);
            co.setDocOrd(1);
            co.setDescriptiveName("Front Cover Page, document 1,3,5,...");

            for (int i = 0; i < 3; i++)
            {
                JDFLayout body = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Body" + (i + 1));
                body.setDescriptiveName("sheet " + (i + 1) + " of 3 of the insert");
                JDFLayout bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Front);

                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(1 + i);
                co.setDocOrd(0);
                co.setDescriptiveName("Front Sheet Body Page, document 0,2,4,...");
                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(1 + (2 * i));
                co.setDocOrd(1);
                co.setDescriptiveName("Front Sheet Body Page, document 1,3,5,...");

                bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Back);

                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(2 + (2 * i));
                co.setDocOrd(0);
                co.setDescriptiveName("Back Sheet Body Page, document 0,2,4,...");
                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(2 + (2 * i));
                co.setDocOrd(1);

                co.setDescriptiveName("Back Sheet Body Page, document 1,3,5,...");
            }
            doc.write2File(sm_dirTestDataTemp + "AutomatedLayout3.jdf", 2, false);
        }
Exemple #11
0
        public virtual void testAutomateLayout_PlateSet()
        {
            for (int loop = 0; loop < 3; loop++)
            {
                n.getAuditPool().appendXMLComment("This is a simple example of an automated layout used for conventional prepress\n" + "The structure is aligned as closely as possible with a static Layout", null);

                JDFRunList run = rl.addRun("file://host/data/test.pdf", 0, -1);
                run.setNPage(128);
                rl.setResStatus(EnumResStatus.Available, true);
                rl.setDescriptiveName("This is a RunList specifiying 128 pages each in a pdf file.");

                lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
                lo.setResStatus(EnumResStatus.Available, true);

                lo.setMaxOrd(4);
                lo.setAutomated(true);
                const string format = "Sheet%02i";
                lo.setAttribute("NameFormat", format);
                lo.setAttribute("NameTemplate", "SheetNum");
                lo.appendXMLComment("Simple automated Layout with exactly one sheet\n", null);
                JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Sheet");
                sheet.setDescriptiveName("two sided 2 up sheet");
                JDFLayout        sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front);
                JDFContentObject co         = sheetFront.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(0);
                co.setDescriptiveName("Front 1st, 5th, 9th... Page");

                co = sheetFront.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(1);
                co.setDescriptiveName("Front 2nd, 6th, 10th... page");

                JDFLayout sheetBack = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Back);
                co = sheetBack.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(2);
                co.setDescriptiveName("Back 3rd, 7th, 11th... Page");

                co = sheetBack.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(3);
                co.setDescriptiveName("Back 4th, 8th, 12th... page");

                JDFRunList rlSheet = (JDFRunList)n.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyOutput, null);
                rlSheet.setDirectory("file://host/out/");
                if (loop == 0) // instantiate individually
                {
                    PrintfFormat fmt = new PrintfFormat(format);
                    for (int i = 0; i < 128; i += 4)
                    {
                        string     sheetName = fmt.tostr(1 + i / 4);
                        JDFRunList rlp       = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.SheetName, sheetName);
                        JDFRunList rlF       = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Front);
                        rlF.appendLayoutElement().setMimeURL(sheetName + "Front.pdf");
                        JDFRunList rlB = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Back);
                        rlB.appendLayoutElement().setMimeURL(sheetName + "Back.pdf");
                    }
                }
                if (loop == 1) // instantiate individually
                {
                    rlSheet.appendLayoutElement().setMimeURL("AllSheets.pdf");
                    PrintfFormat        fmt = new PrintfFormat(format);
                    JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList();
                    for (int i = 0; i < 128; i += 4)
                    {
                        string     sheetName = fmt.tostr(1 + i / 4);
                        JDFRunList rlp       = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.SheetName, sheetName);
                        JDFRunList rlF       = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Front);
                        integerRangeList.Clear();
                        integerRangeList.Append(i / 2);
                        rlF.setPages(integerRangeList);
                        JDFRunList rlB = (JDFRunList)rlp.addPartition(EnumPartIDKey.Side, EnumSide.Back);
                        integerRangeList.Clear();
                        integerRangeList.Append(1 + i / 2);
                        rlB.setPages(integerRangeList);
                    }
                }
                else
                // instantiate by template
                {
                    JDFFileSpec fs = rlSheet.appendLayoutElement().appendFileSpec();
                    fs.setMimeType("application/pdf");
                    fs.setFileFormat(format + "%s_%s.pdf");
                    fs.setFileTemplate("SheetNum,Surface,Separation");
                }

                doc.write2File(sm_dirTestDataTemp + "AutomatedLayout_Plateset" + loop + ".jdf", 2, false);
                n.getResourceLinkPool().deleteNode();
                n.getResourcePool().deleteNode();
            }
        }