Example #1
0
        public virtual void testPreflightProfile()
        {
            JDFDoc d = new JDFDoc("JDF");

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

            inRun = (JDFRunList)n.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyInput, null);
            inRun.setFileURL("input.pdf");

            preparms = (JDFPreflightParams)n.appendMatchingResource(ElementName.PREFLIGHTPARAMS, EnumProcessUsage.AnyInput, null);
            prrp     = (JDFPreflightReportRulePool)n.appendMatchingResource(ElementName.PREFLIGHTREPORTRULEPOOL, EnumProcessUsage.AnyInput, null);

            // new
            aPool = (JDFActionPool)preparms.appendElement(ElementName.ACTIONPOOL);

            // now some simple tests...
            appendTransparency();
            appendNumPagesAction();
            appendSeparationAction();
            appendBWSeparationAction();
            appendTrimBoxAction();
            appendResolutionAction();
            appendResolutionActionBitMap();
            appendLineWeightAction();

            d.write2File(sm_dirTestDataTemp + "PreflightProfile.jdf", 2, false);
        }
Example #2
0
        private void setupRunList(int type)
        {
            JDFIntegerRangeList pageRange = new JDFIntegerRangeList(new JDFIntegerRange(0, -1, 16));

            rlIn.setPartUsage(EnumPartUsage.Sparse);
            rlIn.setDescriptiveName("Explicitly partitioned by LayerIDs to enable layer selextion in the link");
            JDFRunList rlAll = (JDFRunList)rlIn.addPartition(EnumPartIDKey.LayerIDs, "0");

            rlAll.setFileURL("background.pdf");
            rlAll.setPages(pageRange);

            JDFRunList rlLanguage = (JDFRunList)rlIn.addPartition(EnumPartIDKey.LayerIDs, "1");
            JDFRunList rlEn       = (JDFRunList)rlLanguage.addPartition(EnumPartIDKey.PartVersion, "FR");

            rlEn.setFileURL("francais.pdf");
            rlEn.setPages(pageRange);
            rlEn.setLogicalPage(16);

            JDFRunList rlDe = (JDFRunList)rlLanguage.addPartition(EnumPartIDKey.PartVersion, "De");

            rlDe.setFileURL("deutsch.pdf");
            rlDe.setPages(pageRange);
            rlDe.setLogicalPage(16);

            if (type == 1)
            {
                JDFRunList rlCurrency = (JDFRunList)rlIn.addPartition(EnumPartIDKey.LayerIDs, "2");
                JDFRunList rlEur      = (JDFRunList)rlCurrency.addPartition(EnumPartIDKey.PartVersion, "Euro");
                rlEur.setFileURL("€.pdf");
                rlEur.setPages(pageRange);
                rlEur.setLogicalPage(32);
                JDFRunList rlCHF = (JDFRunList)rlCurrency.addPartition(EnumPartIDKey.PartVersion, "CHF");
                rlCHF.setFileURL("Fränkli.pdf");
                rlCHF.setPages(pageRange);
                rlCHF.setLogicalPage(32);
            }
            else if (type == 2)
            {
                JDFRunList rlCurrency = (JDFRunList)rlIn.addPartition(EnumPartIDKey.LayerIDs, "2");
                JDFRunList rlEur      = (JDFRunList)rlCurrency.addPartition(EnumPartIDKey.PartVersion, "De");
                rlEur.setFileURL("€.pdf");
                rlEur.setPages(pageRange);
                rlEur.setLogicalPage(32);

                JDFRunList rlEur2 = (JDFRunList)rlCurrency.addPartition(EnumPartIDKey.PartVersion, "Fr");
                rlEur2.setIdentical(rlEur);

                JDFRunList rlCHF = (JDFRunList)rlCurrency.addPartition(EnumPartIDKey.PartVersion, "Ch");
                rlCHF.setFileURL("Fränkli.pdf");
                rlCHF.setPages(pageRange);
                rlCHF.setLogicalPage(32);

                JDFRunList rlCh = (JDFRunList)rlLanguage.addPartition(EnumPartIDKey.PartVersion, "Ch");
                rlCh.setIdentical(rlDe);
            }
        }
Example #3
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);
        }
Example #4
0
        public virtual void testLayoutPreflight()
        {
            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);
            JDFComment com = lep.appendComment();

            com.setName("Instruction");
            com.setText("Add any human readable instructions here");

            // new
            aPool = (JDFActionPool)lep.appendElement(ElementName.ACTIONPOOL);

            // now some simple tests...
            appendNumPagesAction();
            appendSeparationAction();
            appendBWSeparationAction();
            appendTrimBoxAction();
            appendResolutionAction();
            StatusUtil su = new StatusUtil(n, null, null);

            su.setPhase(EnumNodeStatus.InProgress, "Creative Work", EnumDeviceStatus.Running, null, null);

            su.getDocJMFPhaseTime();
            Thread.Sleep(1000);
            su = new StatusUtil(n, null, null);
            su.setPhase(EnumNodeStatus.InProgress, "Creative Work", EnumDeviceStatus.Running, null, null);
            su.getDocJMFPhaseTime();
            Thread.Sleep(1000);
            su = new StatusUtil(n, null, null);
            su.setPhase(EnumNodeStatus.Completed, "done", EnumDeviceStatus.Idle, null, null);
            su.getDocJMFPhaseTime();
            d.write2File(sm_dirTestDataTemp + "LayoutPreflight.jdf", 2, false);
        }
Example #5
0
        private void iterateThird()
        {
            iterateRead(2);
            JDFPhaseTime pt = iterNode.getAuditPool().setPhase(EnumNodeStatus.InProgress, "Second Iteration Ongoing", null, null);

            pt.setStart(new JDFDate(JDFDate.ToMillisecs(DateTime.Now) + 2000000));
            pt.setEnd(new JDFDate(JDFDate.ToMillisecs(DateTime.Now) + 2100000));
            pt.appendEmployee().setPersonalID("Employee 1");
            pt.appendDevice().setDeviceID("Device 2");
            iterRuli.setResStatus(EnumResStatus.Unavailable, false);
            JDFResourceAudit ra = iterNode.cloneResourceToModify(iterNode.getLink(iterRuli, null));

            iterRuli = (JDFRunList)ra.getNewLink().getTarget();
            iterRuli.setResStatus(EnumResStatus.Draft, false);
            iterRuli.setFileURL(StringUtil.uncToUrl("C:\\local\\MyUpdatedInOutput.pdf", false));

            iterNode.setStatus(EnumNodeStatus.Suspended);
            iterNode.setAttribute("StatusDetails", ITERATION_PAUSED);
            iterDoc.write2File(getIteration(3), 2, false);
        }
Example #6
0
        public virtual void testLayerRunList()
        {
            JDFElement.setLongID(false);
            setUpDoc();
            JDFIntegerRangeList pageRange = new JDFIntegerRangeList(new JDFIntegerRange(0, -1, 16));

            rlIn.setDescriptiveName("Layers are just another partversion layer selection in the link is achieved using multiple partversions");

            JDFRunList rlAll = (JDFRunList)rlIn.addPartition(EnumPartIDKey.PartVersion, "CMYK");

            rlAll.setFileURL("background.pdf");
            rlAll.setPages(pageRange);

            JDFRunList rlEn = (JDFRunList)rlIn.addPartition(EnumPartIDKey.PartVersion, "FR");

            rlEn.setFileURL("Francais.pdf");
            rlEn.setPages(pageRange);
            rlEn.setLogicalPage(16);

            JDFRunList rlDe = (JDFRunList)rlIn.addPartition(EnumPartIDKey.PartVersion, "De");

            rlDe.setFileURL("deutsch.pdf");
            rlDe.setPages(pageRange);
            rlDe.setLogicalPage(16);

            setupLayout(false);

            n.setPartStatus(new JDFAttributeMap(EnumPartIDKey.PartVersion, "De"), EnumNodeStatus.Completed, null);
            JDFResourceLink rl = n.getLink(rlIn, null);

            rl.setPartition(EnumPartIDKey.PartVersion, "CMYK De");
            d.write2File(sm_dirTestDataTemp + "LayerList.jdf", 2, false);
            rl.setPartition(EnumPartIDKey.PartVersion, "De");
            rl.setDescriptiveName("Only DE, no bkg partversion is selected");
            d.write2File(sm_dirTestDataTemp + "LayerList_BKG.jdf", 2, false);
        }
Example #7
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);
        }
Example #8
0
        ///
        ///	 * <param name="n"> </param>
        ///	 * <param name="rlOut"> </param>
        ///
        private void setupLayout(bool complex)
        {
            JDFLayout    lo         = (JDFLayout)n.appendMatchingResource("Layout", EnumProcessUsage.AnyInput, null);
            JDFLayerList ll         = lo.appendLayerList();
            const string layerNames = "BackGround Language";

            VString layers = new VString(layerNames, " ");

            if (complex)
            {
                layers.Add("Currency");
            }

            for (int i = 0; i < layers.Count; i++)
            {
                ll.appendLayerDetails().setName(layers.stringAt(i));
            }

            JDFRunList rlOutDe = (JDFRunList)rlOut.addPartition(EnumPartIDKey.PartVersion, "De");

            rlOutDe.setResStatus(EnumResStatus.Available, true);
            JDFRunList rlOutEn = (JDFRunList)rlOut.addPartition(EnumPartIDKey.PartVersion, "Fr");

            rlOutEn.setResStatus(EnumResStatus.Unavailable, true);
            if (complex)
            {
                JDFRunList rlOutSwiss = (JDFRunList)rlOut.addPartition(EnumPartIDKey.PartVersion, "Ch");
                rlOutSwiss.setResStatus(EnumResStatus.Unavailable, true);
            }

            for (int i = 0; i < 2; i++)
            {
                string     sheetName = "Sheet" + i;
                JDFLayout  lSheet    = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, sheetName);
                JDFRunList rlSheet   = (JDFRunList)rlOutDe.addPartition(EnumPartIDKey.SheetName, sheetName);
                for (int j = 0; j < 2; j++)
                {
                    string     side   = j == 0 ? "Front" : "Back";
                    JDFLayout  lSide  = (JDFLayout)lSheet.addPartition(EnumPartIDKey.Side, side);
                    JDFRunList rlSide = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.Side, side);
                    rlSide.setFileURL("file://out/De/" + sheetName + "_" + side + ".tif");
                    for (int k = 0; k < 4; k++)
                    {
                        JDFContentObject poBkg = lSide.appendContentObject();
                        int ord = i * 8 + j * 4 + k;
                        poBkg.setOrd(ord);
                        poBkg.setOrdID(ord);

                        JDFMatrix matrix = new JDFMatrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
                        matrix.shift((k % 2) * 200, (k / 2) * 300);
                        poBkg.setCTM(matrix);
                        poBkg.setLayerID(0);

                        JDFContentObject poLang = lSide.appendContentObject();
                        poLang.setOrd(ord + 16);
                        poLang.setOrdID(ord);
                        poLang.setCTM(matrix);
                        poLang.setLayerID(1);

                        if (complex)
                        {
                            JDFContentObject pOCurr = lSide.appendContentObject();
                            pOCurr.setOrd(ord + 32);
                            pOCurr.setOrdID(ord);
                            pOCurr.setCTM(matrix);
                            pOCurr.setLayerID(2);
                        }
                    }
                }
            }
        }