/** * @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); } } }
/** * @param os * @param info * @throws IOException */ public XmpWriter(Stream os, IDictionary <string, string> info) : this(os) { if (info != null) { DublinCoreSchema dc = new DublinCoreSchema(); PdfSchema p = new PdfSchema(); XmpBasicSchema basic = new XmpBasicSchema(); String value; foreach (KeyValuePair <string, string> entry in info) { String key = entry.Key; value = 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); } } }
/** * @param os * @param info * @throws IOException */ public XmpWriter(Stream os, IDictionary<string,string> info) : this(os) { if (info != null) { DublinCoreSchema dc = new DublinCoreSchema(); PdfSchema p = new PdfSchema(); XmpBasicSchema basic = new XmpBasicSchema(); String value; foreach (KeyValuePair<string,string> entry in info) { String key = entry.Key; value = 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); } }
/** * @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; String value; foreach (PdfName key in info.Keys) { obj = info.Get(key); if (obj == null) continue; value = ((PdfString)obj).ToUnicodeString(); if (PdfName.TITLE.Equals(key)) { dc.AddTitle(value); } if (PdfName.AUTHOR.Equals(key)) { dc.AddAuthor(value); } if (PdfName.SUBJECT.Equals(key)) { dc.AddSubject(value); dc.AddDescription(value); } if (PdfName.KEYWORDS.Equals(key)) { p.AddKeywords(value); } if (PdfName.CREATOR.Equals(key)) { basic.AddCreatorTool(value); } if (PdfName.PRODUCER.Equals(key)) { p.AddProducer(value); } if (PdfName.CREATIONDATE.Equals(key)) { basic.AddCreateDate(PdfDate.GetW3CDate(obj.ToString())); } if (PdfName.MODDATE.Equals(key)) { basic.AddModDate(PdfDate.GetW3CDate(obj.ToString())); } } 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); } } }
/** * @param os * @param info * @throws IOException */ public XmpWriter(Stream os, PdfDictionary info) : this(os) { if (info != null) { DublinCoreSchema dc = new DublinCoreSchema(); PdfSchema p = new PdfSchema(); XmpBasicSchema basic = new XmpBasicSchema(); PdfObject obj; String value; foreach (PdfName key in info.Keys) { obj = info.Get(key); if (obj == null) { continue; } if (!obj.IsString()) { continue; } value = ((PdfString)obj).ToUnicodeString(); if (PdfName.TITLE.Equals(key)) { dc.AddTitle(value); } if (PdfName.AUTHOR.Equals(key)) { dc.AddAuthor(value); } if (PdfName.SUBJECT.Equals(key)) { dc.AddSubject(value); dc.AddDescription(value); } if (PdfName.KEYWORDS.Equals(key)) { p.AddKeywords(value); } if (PdfName.CREATOR.Equals(key)) { basic.AddCreatorTool(value); } if (PdfName.PRODUCER.Equals(key)) { p.AddProducer(value); } if (PdfName.CREATIONDATE.Equals(key)) { basic.AddCreateDate(PdfDate.GetW3CDate(obj.ToString())); } if (PdfName.MODDATE.Equals(key)) { basic.AddModDate(PdfDate.GetW3CDate(obj.ToString())); } } if (dc.Count > 0) { AddRdfDescription(dc); } if (p.Count > 0) { AddRdfDescription(p); } if (basic.Count > 0) { AddRdfDescription(basic); } } }
/// <summary> /// @throws IOException /// </summary> /// <param name="os"></param> /// <param name="info"></param> public XmpWriter(Stream os, Hashtable info) : this(os) { if (info != null) { var dc = new DublinCoreSchema(); var p = new PdfSchema(); var basic = new XmpBasicSchema(); string value; foreach (DictionaryEntry entry in info) { var 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); } } }
/// <summary> /// @throws IOException /// </summary> public XmpWriter(Stream os, PdfDictionary info, int pdfXConformance) : this(os) { if (info != null) { var dc = new DublinCoreSchema(); var p = new PdfSchema(); var 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) { var a1 = new PdfA1Schema(); if (pdfXConformance == PdfWriter.PDFA1A) { a1.AddConformance("A"); } else { a1.AddConformance("B"); } AddRdfDescription(a1); } } }