本文整理汇总了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();
}
}
示例2: SetProperty
public void SetProperty(string key, XmpArray value)
{
base[key] = value.ToString();
}
示例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);
}
示例4: AddTitle
/**
* Adds a title.
* @param title
*/
public void AddTitle(String title)
{
XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
array.Add(title);
SetProperty(TITLE, array);
}
示例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);
}
示例6: AddSubject
/**
* Adds a subject.
* @param subject
*/
public void AddSubject(String subject)
{
XmpArray array = new XmpArray(XmpArray.UNORDERED);
array.Add(subject);
SetProperty(SUBJECT, array);
}
示例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);
}
示例8: AddDescription
/**
* Adds a description.
* @param desc
*/
public void AddDescription(String desc)
{
XmpArray array = new XmpArray(XmpArray.ALTERNATIVE);
array.Add(desc);
SetProperty(DESCRIPTION, array);
}
示例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);
}
示例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);
}