@Test public void manipulatePdfTest() throws IOException, DocumentException { String fileName = "xmp_metadata_added.pdf"; PdfReader reader = new PdfReader(CMP_FOLDER + "pdf_metadata.pdf"); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(OUT_FOLDER + fileName)); HashMap<String, String> info = reader.getInfo(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); XmpWriter xmp = new XmpWriter(baos, info); xmp.close(); stamper.setXmpMetadata(baos.toByteArray()); stamper.close(); reader.close(); CompareTool ct = new CompareTool(); Assert.assertNull(ct.compareXmp(OUT_FOLDER + fileName, CMP_FOLDER + fileName, true)); }
public void close() throws IOException { if (outputStream == null) return; try { XMPMetaFactory.serialize(xmpMeta, outputStream, serializeOptions); outputStream = null; } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } }
XmpWriter { public void close() throws IOException { if (outputStream == null) return; try { XMPMetaFactory.serialize(xmpMeta, outputStream, serializeOptions); outputStream = null; } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } } }
XmpWriter { public void close() throws IOException { if (outputStream == null) return; try { XMPMetaFactory.serialize(xmpMeta, outputStream, serializeOptions); outputStream = null; } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } } XmpWriter(OutputStream os, String utfEncoding, int extraSpace);  XmpWriter(OutputStream os);  XmpWriter(OutputStream os, PdfDictionary info);  XmpWriter(OutputStream os, Map<String, String> info); }
XmpWriter { public void close() throws IOException { if (outputStream == null) return; try { XMPMetaFactory.serialize(xmpMeta, outputStream, serializeOptions); outputStream = null; } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } } XmpWriter(OutputStream os, String utfEncoding, int extraSpace);  XmpWriter(OutputStream os);  XmpWriter(OutputStream os, PdfDictionary info);  XmpWriter(OutputStream os, Map<String, String> info); XMPMeta getXmpMeta(); void setReadOnly(); void setAbout(String about); @Deprecated void addRdfDescription(String xmlns, String content); @Deprecated void addRdfDescription(XmpSchema s); void setProperty(String schemaNS, String propName, Object value); void appendArrayItem(String schemaNS, String arrayName, String value); void appendOrderedArrayItem(String schemaNS, String arrayName, String value); void appendAlternateArrayItem(String schemaNS, String arrayName, String value); void serialize(OutputStream externalOutputStream); void close(); void addDocInfoProperty(Object key, String value); }
XmpWriter { public void close() throws IOException { if (outputStream == null) return; try { XMPMetaFactory.serialize(xmpMeta, outputStream, serializeOptions); outputStream = null; } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } } XmpWriter(OutputStream os, String utfEncoding, int extraSpace);  XmpWriter(OutputStream os);  XmpWriter(OutputStream os, PdfDictionary info);  XmpWriter(OutputStream os, Map<String, String> info); XMPMeta getXmpMeta(); void setReadOnly(); void setAbout(String about); @Deprecated void addRdfDescription(String xmlns, String content); @Deprecated void addRdfDescription(XmpSchema s); void setProperty(String schemaNS, String propName, Object value); void appendArrayItem(String schemaNS, String arrayName, String value); void appendOrderedArrayItem(String schemaNS, String arrayName, String value); void appendAlternateArrayItem(String schemaNS, String arrayName, String value); void serialize(OutputStream externalOutputStream); void close(); void addDocInfoProperty(Object key, String value); static final String UTF8; static final String UTF16; static final String UTF16BE; static final String UTF16LE; }