public virtual void testObjectTagsMetadata() { KElement tagMap = rl.appendElement(METADATA_MAP); tagMap.setXMLComment("This tagmap specifies The path for the NMTOKEN \"ObjectTag\""); tagMap.setAttribute("Name", "ObjectTags"); tagMap.setAttribute(AttributeName.VALUEFORMAT, "%s"); tagMap.setAttribute(AttributeName.CONTEXT, "Object"); tagMap.setAttribute(AttributeName.DATATYPE, "NMTOKEN"); tagMap.setAttribute(AttributeName.VALUETEMPLATE, "AnyName1"); tagMap.addNameSpace("TIFFXMP", "http://ns.adobe.com/tiff/1.0"); string[] ss = new string[] { "Acme", "Bcme", "Ccme" }; for (int i = 0; i < ss.Length; i++) { string s = ss[i]; KElement tagSet = tagMap.appendElement(EXPR); tagSet.setAttribute("Name", "AnyName1"); tagSet.setAttribute("Value", s); JDFStringEvaluation eval = (JDFStringEvaluation)tagSet.appendElement(ElementName.STRINGEVALUATION); eval.setAttribute("Path", "TIFFXMP:Make"); eval.setRegExp("(.*)" + s + "(.*)"); eval.setXMLComment("Any acme camera is mapped to \"" + s + "\""); } JDFColorSpaceConversionParams csp = (JDFColorSpaceConversionParams)root.addResource(ElementName.COLORSPACECONVERSIONPARAMS, EnumUsage.Input); csp.setXMLComment("This ColorSpaceConversionParams treats Acme and Bcme cameras the same but differentiates for Ccme"); JDFColorSpaceConversionOp op1 = csp.appendColorSpaceConversionOp(); op1.setAttribute("ObjectTags", "Acme Bcme"); JDFColorSpaceConversionOp op2 = csp.appendColorSpaceConversionOp(); op2.setAttribute("ObjectTags", "Ccme"); doc.write2File(sm_dirTestDataTemp + "objectTags.jdf", 2, false); }
/// /// * <param name="sm2_2"> </param> /// * <param name="idAnchor"> </param> /// private static void setNextAnchor(KElement sm2_2, string idAnchor, string anchor, string absolutePosition, string xmlComment, string anchorType) { KElement nextAnchor = sm2_2.appendElement("RefAnchor"); nextAnchor.setAttribute("Anchor", anchor); sm2_2.setAttribute("Offset", absolutePosition); nextAnchor.setAttribute("rRef", idAnchor); nextAnchor.setAttribute("AnchorType", anchorType); nextAnchor.setXMLComment(xmlComment); }
public virtual void testTagMapTiff() { KElement tagMap = rl.appendElement(METADATA_MAP); tagMap.setAttribute("BoundaryKey", "EndOfDocument"); KElement tagSet = tagMap.appendElement(EXPR); tagSet.setAttribute("Path", "/x3141"); tagMap.setXMLComment("This tagmap specifies which document structure corresponds to a Document\n" + " thus incrementing DocIndex or forcing an implicit RunList/@EndofDocument=true\n D100 is the tiff tag 0x3141"); rl.setFileURL("bigVariable.tiff"); rl.setXMLComment("this runlist points to a tiff file with arbitrary structural tagging defined in the tiff tags"); }
/// /// * <param name="sm2_2"> </param> /// * <param name="idAnchor"> </param> /// * <exception cref="FormatException"> </exception> /// private static void setNextAnchor(KElement sm2_2, string idAnchor, string anchor, string absolutePosition, string xmlComment, string anchorType, double rotation) { KElement nextAnchor = sm2_2.appendElement("RefAnchor"); nextAnchor.setAttribute("Anchor", anchor); JDFMatrix m = new JDFMatrix("1 0 0 1 0 0"); JDFXYPair xy = absolutePosition == null ? null : new JDFXYPair(absolutePosition); m.shift(xy); m.rotate(rotation); if (xy != null || rotation != 0) { sm2_2.setAttribute("CTM", m.ToString()); } nextAnchor.setAttribute("rRef", idAnchor); nextAnchor.setAttribute("AnchorType", anchorType); nextAnchor.setXMLComment(xmlComment); }
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); }
public virtual void testTagMap() { JDFLayout lo = (JDFLayout)root.addResource(ElementName.LAYOUT, null, EnumUsage.Input, null, null, null, null); JDFMedia med = (JDFMedia)root.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null); JDFMedia medM = (JDFMedia)med.addPartition(EnumPartIDKey.RunTags, "MaleCover"); JDFMedia medF = (JDFMedia)med.addPartition(EnumPartIDKey.RunTags, "FemaleCover"); JDFMedia medB = (JDFMedia)med.addPartition(EnumPartIDKey.RunTags, "MaleBigBody MaleSmallBody FemaleBigBody FemaleSmallBody"); JDFLayout loM = (JDFLayout)lo.addPartition(EnumPartIDKey.RunTags, "MaleCover"); loM.refElement(medM); JDFLayout loF = (JDFLayout)lo.addPartition(EnumPartIDKey.RunTags, "FemaleCover"); loF.refElement(medF); JDFLayout loBB = (JDFLayout)lo.addPartition(EnumPartIDKey.RunTags, "MaleBigBody FemaleBigBody"); loBB.refElement(medB); JDFLayout loSB = (JDFLayout)lo.addPartition(EnumPartIDKey.RunTags, "MaleSmallBody FemaleSmallBody"); loSB.refElement(medB); lo.setXMLComment("Layout for versioned product"); KElement metaMap = rl.appendElement(METADATA_MAP); metaMap.setXMLComment("The MetadataMap element maps arbitrary tags in the document to a structural RunTag partition key\n" + "Note that any partition key may be mapped.\n" + "Note also that although an XPath syntax is used, this may be mapped to any hierarchical structure including but not limited to XML.\n"); metaMap.setAttribute("Name", "RunTags"); metaMap.setAttribute(AttributeName.DATATYPE, "PartIDKey"); metaMap.setAttribute(AttributeName.VALUEFORMAT, "%s%s"); metaMap.setAttribute(AttributeName.VALUETEMPLATE, "sex,section"); KElement expr = metaMap.appendElement(EXPR); expr.setXMLComment("This expression maps the value of /Dokument/Rezipient/@Sex to a variable \"sex\"\n" + "The Mapping is unconditional, therefore no Term is required"); expr.setAttribute("Name", "sex"); expr.setAttribute("Path", "/Dokument/Rezipient/@Sex"); expr = metaMap.appendElement(EXPR); expr.setXMLComment("Maps all elements with /Dokument/Sektion=Einband to Cover"); expr.setAttribute("Name", "section"); expr.setAttribute("Value", "Cover"); JDFNameEvaluation nev = (JDFNameEvaluation)expr.appendElement(ElementName.NAMEEVALUATION); nev.setAttribute("Path", "/Dokument/Sektion"); nev.setRegExp("Einband"); expr = metaMap.appendElement(EXPR); expr.setXMLComment("Maps all elements with /Dokument/Sektion=HauptTeil and >50 pages to BigBody"); expr.setAttribute("Name", "section"); expr.setAttribute("Value", "BigBody"); JDFand and = (JDFand)expr.appendElement("and"); nev = (JDFNameEvaluation)and.appendElement(ElementName.NAMEEVALUATION); nev.setAttribute("Path", "/Dokument/Sektion"); nev.setRegExp("HauptTeil"); JDFIntegerEvaluation iev = (JDFIntegerEvaluation)and.appendTerm(EnumTerm.IntegerEvaluation); iev.setAttribute("Path", "count(PAGE)"); iev.setValueList(new JDFIntegerRangeList("51~INF")); expr = metaMap.appendElement(EXPR); expr.setXMLComment("Maps all elements with /Dokument/Sektion=HauptTeil and <=50 pages to SmallBody"); expr.setAttribute("Name", "section"); expr.setAttribute("Value", "SmallBody"); and = (JDFand)expr.appendElement("and"); nev = (JDFNameEvaluation)and.appendElement(ElementName.NAMEEVALUATION); nev.setAttribute("Path", "/Dokument/Sektion"); nev.setRegExp("HauptTeil"); iev = (JDFIntegerEvaluation)and.appendTerm(EnumTerm.IntegerEvaluation); iev.setAttribute("Path", "count(PAGE)"); iev.setValueList(new JDFIntegerRangeList("0~INF")); rl.setFileURL("bigVariable.ppml"); rl.setXMLComment("this runlist points to a ppml with arbitrary structural tagging"); JDFResourceLink rll = root.getLink(rl, null); rll.appendPart().setDocIndex(new JDFIntegerRangeList("10 ~ 20")); rll.setXMLComment("this link selects the 11-20 document"); doc.write2File(sm_dirTestDataTemp + "metadataMap.jdf", 2, false); }