Ejemplo n.º 1
0
 /**
 * @param os
 * @param info
 * @throws IOException
 */
 public XmpWriter(Stream os, Hashtable info)
     : this(os)
 {
     if (info != null) {
         DublinCoreSchema dc = new DublinCoreSchema();
         PdfSchema p = new PdfSchema();
         XmpBasicSchema basic = new XmpBasicSchema();
         String value;
         foreach (DictionaryEntry entry in info) {
             String key = (String)entry.Key;
             value = (String)entry.Value;
             if (value == null)
                 continue;
             if ("Title".Equals(key)) {
                 dc.AddTitle(value);
             }
             if ("Author".Equals(key)) {
                 dc.AddAuthor(value);
             }
             if ("Subject".Equals(key)) {
                 dc.AddSubject(value);
                 dc.AddDescription(value);
             }
             if ("Keywords".Equals(key)) {
                 p.AddKeywords(value);
             }
             if ("Creator".Equals(key)) {
                 basic.AddCreatorTool(value);
             }
             if ("Producer".Equals(key)) {
                 p.AddProducer(value);
             }
             if ("CreationDate".Equals(key)) {
                 basic.AddCreateDate(PdfDate.GetW3CDate(value));
             }
             if ("ModDate".Equals(key)) {
                 basic.AddModDate(PdfDate.GetW3CDate(value));
             }
         }
         if (dc.Count > 0) AddRdfDescription(dc);
         if (p.Count > 0) AddRdfDescription(p);
         if (basic.Count > 0) AddRdfDescription(basic);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param os
  * @param info
  * @throws IOException
  */
 public XmpWriter(Stream os, Hashtable info) : this(os) {
     if (info != null)
     {
         DublinCoreSchema dc    = new DublinCoreSchema();
         PdfSchema        p     = new PdfSchema();
         XmpBasicSchema   basic = new XmpBasicSchema();
         String           value;
         foreach (DictionaryEntry entry in info)
         {
             String key = (String)entry.Key;
             value = (String)entry.Value;
             if (value == null)
             {
                 continue;
             }
             if ("Title".Equals(key))
             {
                 dc.AddTitle(value);
             }
             if ("Author".Equals(key))
             {
                 dc.AddAuthor(value);
             }
             if ("Subject".Equals(key))
             {
                 dc.AddSubject(value);
                 dc.AddDescription(value);
             }
             if ("Keywords".Equals(key))
             {
                 p.AddKeywords(value);
             }
             if ("Creator".Equals(key))
             {
                 basic.AddCreatorTool(value);
             }
             if ("Producer".Equals(key))
             {
                 p.AddProducer(value);
             }
             if ("CreationDate".Equals(key))
             {
                 basic.AddCreateDate(PdfDate.GetW3CDate(value));
             }
             if ("ModDate".Equals(key))
             {
                 basic.AddModDate(PdfDate.GetW3CDate(value));
             }
         }
         if (dc.Count > 0)
         {
             AddRdfDescription(dc);
         }
         if (p.Count > 0)
         {
             AddRdfDescription(p);
         }
         if (basic.Count > 0)
         {
             AddRdfDescription(basic);
         }
     }
 }
Ejemplo n.º 3
0
 /**
 * @param os
 * @param info
 * @throws IOException
 */
 public XmpWriter(Stream os, PdfDictionary info, int PdfXConformance)
     : this(os)
 {
     if (info != null) {
         DublinCoreSchema dc = new DublinCoreSchema();
         PdfSchema p = new PdfSchema();
         XmpBasicSchema basic = new XmpBasicSchema();
         PdfObject obj;
         foreach (PdfName key in info.Keys) {
             obj = info.Get(key);
             if (obj == null)
                 continue;
             if (PdfName.TITLE.Equals(key)) {
                 dc.AddTitle(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.AUTHOR.Equals(key)) {
                 dc.AddAuthor(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.SUBJECT.Equals(key)) {
                 dc.AddSubject(((PdfString)obj).ToUnicodeString());
                 dc.AddDescription(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.KEYWORDS.Equals(key)) {
                 p.AddKeywords(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.CREATOR.Equals(key)) {
                 basic.AddCreatorTool(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.PRODUCER.Equals(key)) {
                 p.AddProducer(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.CREATIONDATE.Equals(key)) {
                 basic.AddCreateDate(((PdfDate)obj).GetW3CDate());
             }
             if (PdfName.MODDATE.Equals(key)) {
                 basic.AddModDate(((PdfDate)obj).GetW3CDate());
             }
         }
         if (dc.Count > 0) AddRdfDescription(dc);
         if (p.Count > 0) AddRdfDescription(p);
         if (basic.Count > 0) AddRdfDescription(basic);
         if (PdfXConformance == PdfWriter.PDFA1A || PdfXConformance == PdfWriter.PDFA1B) {
             PdfA1Schema a1 = new PdfA1Schema();
             if (PdfXConformance == PdfWriter.PDFA1A)
                 a1.AddConformance("A");
             else
                 a1.AddConformance("B");
             AddRdfDescription(a1);
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * @param os
  * @param info
  * @throws IOException
  */
 public XmpWriter(Stream os, PdfDictionary info, int PdfXConformance) : this(os) {
     if (info != null)
     {
         DublinCoreSchema dc    = new DublinCoreSchema();
         PdfSchema        p     = new PdfSchema();
         XmpBasicSchema   basic = new XmpBasicSchema();
         PdfObject        obj;
         foreach (PdfName key in info.Keys)
         {
             obj = info.Get(key);
             if (obj == null)
             {
                 continue;
             }
             if (PdfName.TITLE.Equals(key))
             {
                 dc.AddTitle(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.AUTHOR.Equals(key))
             {
                 dc.AddAuthor(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.SUBJECT.Equals(key))
             {
                 dc.AddSubject(((PdfString)obj).ToUnicodeString());
                 dc.AddDescription(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.KEYWORDS.Equals(key))
             {
                 p.AddKeywords(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.CREATOR.Equals(key))
             {
                 basic.AddCreatorTool(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.PRODUCER.Equals(key))
             {
                 p.AddProducer(((PdfString)obj).ToUnicodeString());
             }
             if (PdfName.CREATIONDATE.Equals(key))
             {
                 basic.AddCreateDate(((PdfDate)obj).GetW3CDate());
             }
             if (PdfName.MODDATE.Equals(key))
             {
                 basic.AddModDate(((PdfDate)obj).GetW3CDate());
             }
         }
         if (dc.Count > 0)
         {
             AddRdfDescription(dc);
         }
         if (p.Count > 0)
         {
             AddRdfDescription(p);
         }
         if (basic.Count > 0)
         {
             AddRdfDescription(basic);
         }
         if (PdfXConformance == PdfWriter.PDFA1A || PdfXConformance == PdfWriter.PDFA1B)
         {
             PdfA1Schema a1 = new PdfA1Schema();
             if (PdfXConformance == PdfWriter.PDFA1A)
             {
                 a1.AddConformance("A");
             }
             else
             {
                 a1.AddConformance("B");
             }
             AddRdfDescription(a1);
         }
     }
 }