-none- 2007-08-24 - By Vincent CAURIER
Back Hi,
I want to add some XMP metadatas to a pdf file I have to generate. I found some examples, but nothing dealing with adding XMP metadatas to a document before closing it. This code is maybe supposed to help me, but I don't find the link with my Document Object or my FileOutputStream :
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);
xmp.close(); writer.setXmpMetadata(os.toByteArray());
Please help, thanks !
-- Vincent CAURIER
Hi,<br><br>I want to add some XMP metadatas to a pdf file I have to generate. I found some examples, but nothing dealing with adding XMP metadatas to a document before closing it. This code is maybe supposed to help me, but I don& #39;t find the link with my Document Object or my FileOutputStream : <br><br><pre style="margin: 0em;"><br>ByteArrayOutputStream os = new ByteArrayOutputStream();<br>XmpWriter xmp = new XmpWriter(os);<br>XmpSchema dc = new DublinCoreSchema();<br>XmpArray subject = new XmpArray(XmpArray.UNORDERED );<br>subject.add("Hello World");<br>subject.add("XMP & Metadata");<br>subject.add("Metadata");<br>dc.setProperty (DublinCoreSchema.SUBJECT, subject);<br>xmp.addRdfDescription(dc);<br>PdfSchema pdf = new PdfSchema(); <br>pdf.setProperty(PdfSchema.KEYWORDS, "Hello World, XMP, Metadata") ;<br>pdf.setProperty(PdfSchema.VERSION, "1.4");<br>xmp .addRdfDescription(pdf);</pre><pre style="margin: 0em;">xmp.close();<br>writer .setXmpMetadata (os.toByteArray());</pre><br><br clear="all">Please help, thanks !<br><br>-- <br>Vincent CAURIER<br>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|