當前位置: 首頁>>代碼示例>>C#>>正文


C# xmp.XmpArray類代碼示例

本文整理匯總了C#中iTextSharp.text.xml.xmp.XmpArray的典型用法代碼示例。如果您正苦於以下問題:C# XmpArray類的具體用法?C# XmpArray怎麽用?C# XmpArray使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XmpArray類屬於iTextSharp.text.xml.xmp命名空間,在下文中一共展示了XmpArray類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreatePdf

// ---------------------------------------------------------------------------
/**
 * Creates a PDF document.
 */
    public byte[] CreatePdf() {
      using (MemoryStream ms = new MemoryStream()) {
        // step 1
        using (Document document = new Document()) {
        // step 2
          PdfWriter writer = PdfWriter.GetInstance(document, ms);
          using (MemoryStream msXmp = new MemoryStream()) {
            XmpWriter xmp = new XmpWriter(msXmp);
            XmpSchema dc = new DublinCoreSchema();
            XmpArray subject = new XmpArray(XmpArray.UNORDERED);
            subject.Add("Hello World");
            subject.Add("XMP & Metadata");
            subject.Add("Metadata");
            dc.SetProperty(DublinCoreSchema.SUBJECT, subject);
            xmp.AddRdfDescription(dc);
            PdfSchema pdf = new PdfSchema();
/*
 *  iTextSharp uses Item property instead of Java setProperty() method
 * 
 *      pdf.SetProperty(PdfSchema.KEYWORDS, "Hello World, XMP, Metadata");
 *      pdf.SetProperty(PdfSchema.VERSION, "1.4");
 */
            pdf[PdfSchema.KEYWORDS] = "Hello World, XMP, Metadata";
            pdf[PdfSchema.VERSION] = "1.4";
            xmp.AddRdfDescription(pdf);
            xmp.Close();
            writer.XmpMetadata = ms.ToArray();
          }
          // step 3
          document.Open();
          // step 4
          document.Add(new Paragraph("Hello World"));
        }
        return ms.ToArray();
      }
    }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:40,代碼來源:MetadataXmp.cs

示例2: SetProperty

 public void SetProperty(string key, XmpArray value)
 {
     base[key] = value.ToString();
 }
開發者ID:mapo80,項目名稱:iTextSharp-Monotouch,代碼行數:4,代碼來源:XmpSchema.cs

示例3: AddIdentifiers

 /** Adds the identifier.
 * @param id
 */
 virtual public void AddIdentifiers(String[] id) {
     XmpArray array = new XmpArray(XmpArray.UNORDERED);
     for (int i = 0; i < id.Length; i++) {
         array.Add(id[i]);
     }
     SetProperty(IDENTIFIER, array);
 }
開發者ID:joshaxey,項目名稱:Simple-PDFMerge,代碼行數:10,代碼來源:XmpBasicSchema.cs

示例4: AddTitle

 /**
 * Adds a title.
 * @param title
 */
 public void AddTitle(String title)
 {
     XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
     array.Add(title);
     SetProperty(TITLE, array);
 }
開發者ID:jomamorales,項目名稱:createPDF,代碼行數:10,代碼來源:DublinCoreSchema.cs

示例5: addSubject

 /**
 * Adds a subject.
 * @param subject array of subjects
 */
 public void addSubject(String[] subject)
 {
     XmpArray array = new XmpArray(XmpArray.UNORDERED);
     for (int i = 0; i < subject.Length; i++) {
         array.Add(subject[i]);
     }
     SetProperty(SUBJECT, array);
 }
開發者ID:jomamorales,項目名稱:createPDF,代碼行數:12,代碼來源:DublinCoreSchema.cs

示例6: AddSubject

 /**
 * Adds a subject.
 * @param subject
 */
 public void AddSubject(String subject)
 {
     XmpArray array = new XmpArray(XmpArray.UNORDERED);
     array.Add(subject);
     SetProperty(SUBJECT, array);
 }
開發者ID:jomamorales,項目名稱:createPDF,代碼行數:10,代碼來源:DublinCoreSchema.cs

示例7: AddPublisher

 /**
 * Adds an array of publishers.
 * @param publisher
 */
 public void AddPublisher(String[] publisher)
 {
     XmpArray array = new XmpArray(XmpArray.ORDERED);
     for (int i = 0; i < publisher.Length; i++) {
         array.Add(publisher[i]);
     }
     SetProperty(PUBLISHER, array);
 }
開發者ID:jomamorales,項目名稱:createPDF,代碼行數:12,代碼來源:DublinCoreSchema.cs

示例8: AddDescription

 /**
 * Adds a description.
 * @param desc
 */
 public void AddDescription(String desc)
 {
     XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
     array.Add(desc);
     SetProperty(DESCRIPTION, array);
 }
開發者ID:jomamorales,項目名稱:createPDF,代碼行數:10,代碼來源:DublinCoreSchema.cs

示例9: AddAuthor

 /**
 * Adds an array of authors.
 * @param author
 */
 public void AddAuthor(String[] author)
 {
     XmpArray array = new XmpArray(XmpArray.ORDERED);
     for (int i = 0; i < author.Length; i++) {
         array.Add(author[i]);
     }
     SetProperty(CREATOR, array);
 }
開發者ID:jomamorales,項目名稱:createPDF,代碼行數:12,代碼來源:DublinCoreSchema.cs

示例10: DeprecatedLogicTest

        virtual public void DeprecatedLogicTest() {
            String fileName = "xmp_metadata_deprecated.pdf";
            // step 1
            Document document = new Document();
            // step 2
            PdfWriter writer = PdfAWriter.GetInstance(document, new FileStream(OUT_FOLDER + fileName, FileMode.Create),
                                                      PdfAConformanceLevel.PDF_A_2B);
            MemoryStream os = new MemoryStream();
            XmpWriter xmp = new PdfAXmpWriter(os, PdfAConformanceLevel.PDF_A_2B, writer);
            XmpSchema dc = new DublinCoreSchema();
            XmpArray subject = new XmpArray(XmpArray.UNORDERED);
            subject.Add("Hello World");
            subject.Add("XMP & Metadata");
            subject.Add("Metadata");
            dc.SetProperty(DublinCoreSchema.SUBJECT, subject);
            xmp.AddRdfDescription(dc.Xmlns, dc.ToString());
            PdfSchema pdf = new PdfSchema();
            pdf.AddKeywords("Hello World, XMP & Metadata, Metadata");
            pdf.AddVersion("1.4");
            xmp.AddRdfDescription(pdf);
            xmp.Close();
            writer.XmpMetadata = os.ToArray();
            // step 3
            document.Open();
            document.AddLanguage("en_US");
            // step 4
            Font font = FontFactory.GetFont("../../resources/text/pdfa/FreeMonoBold.ttf", BaseFont.WINANSI,
                                            BaseFont.EMBEDDED, 12);
            document.Add(new Paragraph("Hello World", font));

            FileStream iccStream = new FileStream("../../resources/text/pdfa/sRGB Color Space Profile.icm",
                                                 FileMode.Open);
            ICC_Profile icc = ICC_Profile.GetInstance(iccStream);
            iccStream.Close();

            writer.SetOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
            // step 5
            document.Close();
            CompareResults("xmp_metadata_deprecated.pdf", fileName);
        }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:40,代碼來源:PdfAXmpWriterTest.cs


注:本文中的iTextSharp.text.xml.xmp.XmpArray類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。