Leonard Rosenthol wrote:
At 03:56 PM 3/13/2006, Phil Poupart wrote:
There has to be a simple way to add XMP tags to an existing PDF.
Depends on your definition of simple...
But basically, you get the XMP data from the PDF via iText.
You use you favorite XML technology to modify the XMP. Then you put
the XMP back via iText.
ByteArrayOutputStream os = new ByteArrayOutputStream();
XmpWriter xmp = new XmpWriter(os);
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();
pdf.setProperty(PdfSchema.KEYWORDS, "Hello World, XMP, Metadata");
pdf.setProperty(PdfSchema.VERSION, "1.4");
xmp.addRdfDescription(pdf);
and so on...
Create any XmpSchema implementation you want and
add it to the XmpWriter, then close the XmpWriter:
xmp.close();
writer.setXmpMetadata(os.toByteArray());
I don't see why people think this is difficult?
br,
Bruno
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions