当前位置: 首页>>代码示例>>C#>>正文


C# IXmpMeta.GetProperty方法代码示例

本文整理汇总了C#中IXmpMeta.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IXmpMeta.GetProperty方法的具体用法?C# IXmpMeta.GetProperty怎么用?C# IXmpMeta.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IXmpMeta的用法示例。


在下文中一共展示了IXmpMeta.GetProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadPdfAInfo

 private void ReadPdfAInfo() {
     byte[] metadata = null;
     
     IXmpProperty pdfaidConformance = null;
     IXmpProperty pdfaidPart = null;
     try {
         metadata = reader.Metadata;
         xmpMeta = XmpMetaParser.Parse(metadata, null);
         pdfaidConformance = xmpMeta.GetProperty(XmpConst.NS_PDFA_ID, "pdfaid:conformance");
         pdfaidPart = xmpMeta.GetProperty(XmpConst.NS_PDFA_ID, "pdfaid:part");
     } catch(Exception e) {
         throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("only.pdfa.documents.can.be.opened.in.PdfAStamper"));
     }
     if(pdfaidConformance == null || pdfaidPart == null) {
         throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("only.pdfa.documents.can.be.opened.in.PdfAStamper"));
     }
     switch(((IPdfAConformance)pdfIsoConformance).ConformanceLevel) {
         case PdfAConformanceLevel.PDF_A_1A:
         case PdfAConformanceLevel.PDF_A_1B:
             if(!"1".Equals(pdfaidPart.Value)) {
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("only.pdfa.1.documents.can.be.opened.in.PdfAStamper", "1"));
             }
             break;
         case PdfAConformanceLevel.PDF_A_2A:
         case PdfAConformanceLevel.PDF_A_2B:
         case PdfAConformanceLevel.PDF_A_2U:
             if(!"2".Equals(pdfaidPart.Value)) {
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("only.pdfa.1.documents.can.be.opened.in.PdfAStamper", "2"));
             }
             break;
         case PdfAConformanceLevel.PDF_A_3A:
         case PdfAConformanceLevel.PDF_A_3B:
         case PdfAConformanceLevel.PDF_A_3U:
             if(!"3".Equals(pdfaidPart.Value)) {
                 throw new PdfAConformanceException(MessageLocalization.GetComposedMessage("only.pdfa.1.documents.can.be.opened.in.PdfAStamper", "3"));
             }
             break;
     }
 }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:39,代码来源:PdfAStamperImp.cs

示例2: CoverGetPropertyMethods

        /**
         * Test getProperty, deleteProperty and related methods.
         * @param meta a predefined <code>XmpMeta</code> object.
         * @throws XmpException Forwards exceptions
         */
        private static void CoverGetPropertyMethods(IXmpMeta meta)
        {
            writeMajorLabel ("Test getProperty, deleteProperty and related methods");

            meta.DeleteProperty (TestData.NS1, "QualProp1");    // ! Start with fresh qualifiers.
            meta.DeleteProperty (TestData.NS1, "ns1:QualProp2");
            meta.DeleteProperty (TestData.NS1, "ns1:QualProp3");
            meta.DeleteProperty (TestData.NS1, "QualProp4");

            writeMinorLabel("Set properties with qualifier");

            meta.SetProperty (TestData.NS1, "QualProp1", "Prop value");
            meta.SetQualifier (TestData.NS1, "QualProp1", TestData.NS2, "Qual1", "Qual1 value");

            meta.SetProperty (TestData.NS1, "QualProp2", "Prop value");
            meta.SetQualifier (TestData.NS1, "QualProp2", XmpConstants.NsXml, "lang", "en-us");

            meta.SetProperty (TestData.NS1, "QualProp3", "Prop value");
            meta.SetQualifier (TestData.NS1, "QualProp3", XmpConstants.NsXml, "lang", "en-us");
            meta.SetQualifier (TestData.NS1, "QualProp3", TestData.NS2, "Qual", "Qual value");

            meta.SetProperty (TestData.NS1, "QualProp4", "Prop value");
            meta.SetQualifier (TestData.NS1, "QualProp4", TestData.NS2, "Qual", "Qual value");
            meta.SetQualifier (TestData.NS1, "QualProp4", XmpConstants.NsXml, "lang", "en-us");

            printXmpMeta (meta, "XMP object");

            writeMinorLabel("Get simple properties");

            var property = meta.GetProperty(TestData.NS1, "Prop");
            log.WriteLine("getProperty ns1:Prop =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetProperty(TestData.NS1, "ns1:XMLProp");
            log.WriteLine("getProperty ns1:XMLProp =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetProperty(TestData.NS1, "ns1:URIProp");
            log.WriteLine("getProperty ns1:URIProp =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetArrayItem(TestData.NS1, "Bag", 2);
            log.WriteLine("getArrayItem ns1:Bag[2] =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            try
            {
                meta.GetArrayItem(null, "ns1:Bag", 1);
            }
            catch (XmpException e)
            {
                log.WriteLine("getArrayItem with no schema URI - threw XmpException #" + e.GetErrorCode() +" :   " + e.Message + ")");
            }

            writeMinorLabel("Get array items and struct fields");

            property = meta.GetArrayItem(TestData.NS1, "ns1:Seq", 1);
            log.WriteLine("getArrayItem ns1:Seq[1] =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetArrayItem(TestData.NS1, "ns1:Alt", 1);
            log.WriteLine("getArrayItem ns1:Alt[1] =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");
            log.WriteLine();

            property = meta.GetStructField(TestData.NS1, "Struct", TestData.NS2, "Field1");
            log.WriteLine("getStructField ns1:Struct/ns2:Field1 =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetStructField(TestData.NS1, "ns1:Struct", TestData.NS2, "Field2");
            log.WriteLine("getStructField ns1:Struct/ns2:Field2 =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetStructField(TestData.NS1, "ns1:Struct", TestData.NS2, "ns2:Field3");
            log.WriteLine("getStructField ns1:Struct/ns2:Field3 =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetStructField(TestData.NS1, "ns1:Struct", TestData.NS2, "ns2:Field3");
            log.WriteLine("getStructField ns1:Struct/ns2:Field3 =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetStructField(TestData.NS1, "ns1:Struct", TestData.NS2, "ns2:Field3");
            log.WriteLine("getStructField ns1:Struct/ns2:Field3 =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");
            log.WriteLine();

            writeMinorLabel("Get qualifier");

            property = meta.GetQualifier(TestData.NS1, "QualProp1", TestData.NS2, "Qual1");
            log.WriteLine("getQualifier  ns1:QualProp1/?ns2:Qual1 =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            try
            {
                meta.GetQualifier(null, "ns1:QualProp1", TestData.NS2, "Qual1");
            }
            catch (XmpException e)
            {
                log.WriteLine("getQualifier with no schema URI - threw XmpException #" + e.GetErrorCode() + " :   " + e.Message);
            }

            property = meta.GetQualifier(TestData.NS1, "QualProp3", XmpConstants.NsXml, "xml:lang");
            log.WriteLine("getQualifier ns1:QualProp3/@xml-lang =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");

            property = meta.GetQualifier(TestData.NS1, "QualProp3", TestData.NS2, "ns2:Qual");
            log.WriteLine("getQualifier ns1:QualProp3/?ns2:Qual =   " + property.Value + " (" + property.Options.GetOptionsString() + ")");
            log.WriteLine();
//.........这里部分代码省略.........
开发者ID:ashbook,项目名称:xmp-core-dotnet,代码行数:101,代码来源:XMPCoreCoverage.cs


注:本文中的IXmpMeta.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。