Exemple #1
0
        ///
        ///	 * <param name="cl"> </param>
        ///	 * <param name="lePart"> </param>
        ///
        private JDFContentData addMetaData(JDFContentList cl, JDFLayoutElementPart lePart)
        {
            JDFContentData cd = cl.appendContentData();

            lePart.setAttribute("ContentDataIndex", cd.getIndex(), null);
            return(cd);
        }
Exemple #2
0
        public virtual void testContentData()
        {
            d = new JDFDoc("JDF");
            n = d.getJDFRoot();
            n.setType(EnumType.Approval);
            JDFRunList rl = (JDFRunList)n.addResource(ElementName.RUNLIST, EnumUsage.Input);

            pl = rl.appendPageList();
            pl.makeRootResource("PageList", null, true);

            cl = pl.appendContentList();
            cl.makeRootResource("ContentList", null, true);
            JDFContentData cd0 = cl.appendContentData();

            cd0.setAttribute(AttributeName.CONTENTLISTINDEX, "1 2 3");
            KElement book = cd0.appendElement("ContentMetaData");

            book.setAttribute("ISBN", "0123456789");
            JDFComment abstrakt = (JDFComment)book.appendElement("Comment");

            abstrakt.setName("Abstract");
            abstrakt.setText("Abstract of the book\nin english");
            JDFEmployee editor = (JDFEmployee)book.appendElement(ElementName.EMPLOYEE);

            editor.appendPerson().setFamilyName("authorName");
            editor.setRoles(new VString("Editor", null));
            book.setAttribute("Title", "book thing");
            int p = 1;

            for (int i = 1; i < 4; i++)
            {
                JDFContentData cd = cl.appendContentData();
                cd.setAttribute("ID", "CD_" + i);
                KElement chap = cd.appendElement("ContentMetaData");
                chap.setAttribute("Title", "Chapter " + i);
                JDFEmployee author = (JDFEmployee)chap.appendElement(ElementName.EMPLOYEE);
                author.appendPerson().setFamilyName("authorName" + i);
                author.setRoles(new VString("Author", null));

                JDFPageData         pd = pl.appendPageData();
                JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList();
                integerRangeList.Append(p, p + i);
                p += i + 1;
                pd.setAttribute("PageIndex", integerRangeList.ToString());
                JDFPageElement pe = pd.appendPageElement();
                pe.setAttribute("ContentDataRefs", cd.getID());
            }
            pl.setXMLComment("Note that multiple page elements may but need not be specified\nit is also possible to reference only on pageEleemnt that spans the entire book");

            d.write2File(sm_dirTestDataTemp + "ContentMetaData.jdf", 2, false);
        }
Exemple #3
0
        public virtual void testVariableManifests()
        {
            ruli.setXMLComment("the set / doc / ... structure is transferred from the pre-impositioning pdl");

            JDFPageList pl = (JDFPageList)n.addResource(ElementName.PAGELIST, null);

            pl.setResStatus(EnumResStatus.Available, false);

            JDFContentList cl = (JDFContentList)pl.appendContentList().makeRootResource(null, null, true);

            cl.setResStatus(EnumResStatus.Available, false);
            cl.setXMLComment("Should we allow for content-data cross references to forther contentdata fields?");
            ruli.refPageList(pl);
            comp.refPageList(pl);
            int pageCount = 0;

            digiParams.setSides(EnumSides.TwoSidedFlipY);
            digiParams.setXMLComment("the sides attribute may be overridden by explicitly or implicitly missing runlist input elements");

            VString vRun = new VString("Letter BrochureMale BrochureFemale", null);

            JDFStitchingParams sp = (JDFStitchingParams)n.addResource(ElementName.STITCHINGPARAMS, EnumUsage.Input);

            med.setXMLComment("Media Partitioning is convenience only- the actual media selection is done by the digitalprintingparams MediaRef");
            for (int i = 0; i < vRun.Count; i++)
            {
                string   part      = vRun[i];
                JDFMedia partMedia = (JDFMedia)med.addPartition(EnumPartIDKey.Run, part);
                partMedia.setProductID(part + "Media");

                JDFDigitalPrintingParams digiPart = (JDFDigitalPrintingParams)digiParams.addPartition(EnumPartIDKey.Run, part);
                digiPart.refMedia(partMedia);

                sp.setXMLComment("how are multiple runs stitched together e.g. cover + body?");
                JDFStitchingParams spPart = (JDFStitchingParams)sp.addPartition(EnumPartIDKey.Run, part);
                if (i == 0)
                {
                    spPart.setNoOp(true);
                    spPart.setDescriptiveName("The letter is a loose leaf collection");
                }
                else
                {
                    spPart.setNumberOfStitches(3);
                    spPart.setStitchType(EnumStitchType.Saddle);
                }
            }

            // loop over records
            for (int i = 0; i < 10; i++)
            {
                JDFContentData letter = cl.appendContentData();
                letter.setContentType("Letter");
                JDFContentData brochure = cl.appendContentData();
                brochure.setContentType("Brochure");
                KElement lMeta = letter.appendElement("ContentMetadata");
                // TODO apply new example
                lMeta.setAttribute("Record", "" + i);
                string gender = i % 2 == 0 ? "Male" : "Female";
                lMeta.setAttribute("Gender", gender);
                lMeta.setXMLComment("Note that the final format of the metadata element is open");
                KElement bMeta = brochure.appendElement("Metadata");
                bMeta.setAttribute("Record", "" + i);
                bMeta.setAttribute("Gender", gender);

                JDFRunList runSet = (JDFRunList)ruli.addPartition(EnumPartIDKey.RunSet, "Record" + i);
                JDFRunList run    = runSet.addRun("file://server/tifs/testLetter" + i + ".tif", 0, -1);
                run.setRun("Letter");
                JDFComponent compSet = (JDFComponent)comp.addPartition(EnumPartIDKey.RunSet, runSet.getRunSet());
                JDFComponent co      = (JDFComponent)compSet.addPartition(EnumPartIDKey.Run, run.getRun());
                int          page    = (3 * i) % 7 + 1;
                run.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1)));
                co.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1)));
                co.setSurfaceCount(2 * ((page + 1) / 2));
                run.setPages(new JDFIntegerRangeList("0~" + (page - 1)));
                run.setXMLComment("Cover Letter - record " + i);
                run.setEndOfDocument(true);
                JDFPageData pd = pl.appendPageData();
                pd.refContentData(letter);
                pd.setAttribute("PageIndex", pageCount + " ~ " + (pageCount + page - 1));
                pageCount += page;

                run = runSet.addRun("file://server/tifs/testBrochure" + i + ".tif", 0, -1);
                run.setRun("Brochure" + gender);

                co   = (JDFComponent)compSet.addPartition(EnumPartIDKey.Run, run.getRun());
                page = 2 * ((7 * i) % 13) + 2;
                run.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1)));
                co.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1)));
                co.setSurfaceCount(2 * ((page + 1 + 1) / 2)); // the 2nd +1 is for
                // the blank inside
                // cover
                run.setPages(new JDFIntegerRangeList("0~" + (page - 1)));
                run.setXMLComment("Brochure - record " + i);
                run.setEndOfDocument(true);
                runSet.setEndOfSet(true);
                run.setAttribute("SkipBlankOrds", "1");
                run.setNPage(page + 1);
                run.setXMLComment("SkipBlankOrds specifies the relative position of pages to skip\n1 specifies that the first back sheet is skipped\nNPage MUST be incremented by the # of skipped pages.");
                pd = pl.appendPageData();
                pd.refContentData(brochure);
                pd.setAttribute("PageIndex", pageCount + " ~ " + (pageCount + page - 1));
                pageCount += page;
            }
            doc.write2File(sm_dirTestDataTemp + "RunlistManifest.jdf", 2, false);
        }
Exemple #4
0
        private JDFLayoutElementPart addLayoutElementPart(JDFLayoutElementProductionParams lep, JDFContentList cl)
        {
            JDFLayoutElementPart lePart = lep.appendLayoutElementPart();

            addMetaData(cl, lePart);
            return(lePart);
        }
Exemple #5
0
        public virtual void testLayoutElementPositioning()
        {
            // TBD: Fuzzy, Sizes, literal text via comments
            JDFElement.setLongID(false);
            JDFDoc d = new JDFDoc("JDF");

            n = d.getJDFRoot();
            n.setType(EnumType.LayoutElementProduction);

            JDFRunList outRun = (JDFRunList)n.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyOutput, null);

            outRun.setFileURL("output.pdf");

            JDFLayoutElementProductionParams lep = (JDFLayoutElementProductionParams)n.appendMatchingResource(ElementName.LAYOUTELEMENTPRODUCTIONPARAMS, EnumProcessUsage.AnyInput, null);

            lep.appendXMLComment("This is a \"well placed\" CTM defined mark\nThe anchor defines the 0,0 point to be transformed\nThe element to be placed is referenced by LayoutElement/FileSpec/URL", null);

            JDFContentList cl = (JDFContentList)lep.appendElement(ElementName.CONTENTLIST);

            cl = (JDFContentList)cl.makeRootResource(null, null, true);
            cl.setXMLComment("this is an optional metadatapool for the content");

            JDFLayoutElementPart lePart      = addLayoutElementPart(lep, cl);
            KElement             positionObj = lePart.appendElement("PositionObject");

            positionObj.setAttribute("PageRange", "0");
            setNextAnchor(positionObj, null, "LowLeft", "0 0", null, "Parent", 0);
            positionObj.setAttribute("Anchor", "LowLeft");
            positionObj.setAttribute("PositionPolicy", "Exact");
            JDFLayoutElement bkg = (JDFLayoutElement)lePart.appendElement("LayoutElement");

            bkg.setMimeURL("bkg.pdf");

            lep.appendXMLComment("This is a \"roughly placed\" reservation in the middle of the page", null);
            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "0");
            // TODO discuss individual positions
            setNextAnchor(positionObj, null, "Center", null, null, "Parent", 0);
            positionObj.setAttribute("Anchor", "Center");
            positionObj.setAttribute("PositionPolicy", "Free");
            string id = lePart.appendAnchor(null);

            JDFLayoutElement image = (JDFLayoutElement)lePart.appendElement("LayoutElement");

            image.setElementType(EnumElementType.Image);
            image.appendComment().setText("Please add an image of a palm tree on a beach here!");

            lep.appendXMLComment("This is a \"roughly placed\" reservation 36 points below the previous image;\n NextPosition points from Anchor on this to NextAnchor on next,\n i.e. a positive vector specifies that next is shifted in the positive direction in the parent (in this case page) coordinate system", null);
            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "0");
            positionObj.setAttribute("Anchor", "TopCenter");
            positionObj.setAttribute("PositionPolicy", "Free");
            setNextAnchor(positionObj, id, "BottomCenter", "0 36", null, "Sibling", 0);

            image = (JDFLayoutElement)lePart.appendElement("LayoutElement");
            image.setElementType(EnumElementType.Image);
            image.appendComment().setText("Please add an image of a beach ball below the palm tree!");

            lep.appendXMLComment("This is a \"well placed\" CTM defined mark\nThe anchor defines the 0,0 point to be transformed", null);
            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "0");
            setNextAnchor(positionObj, null, "BottomLeft", "2 3", null, "Parent", 0);
            positionObj.setAttribute("Anchor", "LowLeft");
            positionObj.setAttribute("PositionPolicy", "Exact");
            lePart.appendBarcodeProductionParams().appendXMLComment("barcode details here", null);

            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "0");
            setNextAnchor(positionObj, null, "TopRight", null, null, "Parent", 0);
            positionObj.setAttribute("Anchor", "TopRight");
            positionObj.appendXMLComment("This is a \"roughly placed\"  mark\nThe anchor at top right is placed at the right (=1.0) top(=1.0) position of the page.\nNo rotation is specified", null);
            positionObj.setAttribute("PositionPolicy", "Exact");
            lePart.appendBarcodeProductionParams().appendXMLComment("barcode details here", null);
            lep.appendXMLComment("This is a \"roughly placed\"  container for marks\nThe anchor at top left is defined in the !Unrotated! orientation.\n It is placed at the left (=0.0) bottom(=0.0) position of the page.\nThe text flows bottom to top (=Rotate 90 = counterclockwise)\n do we need margins?", null);

            lePart = addLayoutElementPart(lep, cl);
            string idParent = lePart.appendAnchor(null);

            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "1");
            positionObj.setAttribute("Anchor", "TopLeft");
            positionObj.setAttribute("PositionPolicy", "Free");
            setNextAnchor(positionObj, null, "BottomCenter", "0 0", null, "Parent", 90);
            lep.appendXMLComment("This is a  barcode inside the previous container\nThe anchor at bottom left is defined in the !Unrotated! orientation.\n It is placed at the left (=0.0) bottom(=0.0) position of the container.", null);

            lePart      = addLayoutElementPart(lep, cl);
            id          = lePart.appendAnchor(null);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("Anchor", "BottomLeft");
            setNextAnchor(positionObj, idParent, "BottomLeft", "0 0", null, "Parent", 0);
            lePart.appendBarcodeProductionParams().appendXMLComment("barcode details here", null);
            lep.appendXMLComment("This is a disclaimer text inside the previous container\nThe anchor at top left is defined in the !Unrotated! orientation.\n The barcode and text are justified with their top margins and spaced by 72 points\n which corresponds to the left of the page because the container is rotated 90°\n" + "AbsoluteSize specifies the size of the object in points", null);

            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            setNextAnchor(positionObj, id, "TopRight", "-72 0", null, "Sibling", 0);

            positionObj.setAttribute("Anchor", "TopLeft");
            // positionObj.setAttribute("ParentRef", idParent);
            positionObj.setAttribute("AbsoluteSize", "300 200");
            JDFLayoutElement text = (JDFLayoutElement)lePart.appendElement("LayoutElement");

            text.setElementType(EnumElementType.Text);
            text.setMimeURL("file://myServer/disclaimers/de/aspirin.txt");
            lep.appendXMLComment("This is a \"VERY roughly placed\" piece of text somewhere on pages 2-3\n" + "RelativeSize specifies the size of the object as a ratio of the size of the container", null);

            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "1 ~ 2");
            positionObj.setAttribute("RelativeSize", "0.8 0.5");
            text = (JDFLayoutElement)lePart.appendElement("LayoutElement");
            text.setElementType(EnumElementType.Text);
            JDFComment instructionComment = text.appendComment();

            instructionComment.setName("Instructions");
            instructionComment.setText("Please add some text about the image of a palm tree on a beach here!");
            lep.appendXMLComment("This is another \"VERY roughly placed\" piece of text somewhere on pages 2-3; the text source is the JDF", null);

            lePart      = addLayoutElementPart(lep, cl);
            positionObj = lePart.appendElement("PositionObject");
            positionObj.setAttribute("PageRange", "1 ~ 2");
            text = (JDFLayoutElement)lePart.appendElement("LayoutElement");
            text.setElementType(EnumElementType.Text);

            JDFComment textSrc = text.appendComment();

            textSrc.setName("TextInput");
            textSrc.setText("Laurum Ipsum Blah blah blah!\n btw. this is unformatted plain text and nothing else!");

            d.write2File(sm_dirTestDataTemp + "LayoutPositionObj.jdf", 2, false);
        }
Exemple #6
0
 ///
 ///      <summary> * (31) create inter-resource link to refTarget </summary>
 ///      * <param name="refTarget"> the element that is referenced </param>
 ///
 public virtual void refContentList(JDFContentList refTarget)
 {
     refElement(refTarget);
 }