/** * @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, 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); } } }