Hi

I've developped a patch to make iText not modify metadata on
PdfStamperImp.java unless explicitily instructed.

Patch attached

--- a/core/com/lowagie/text/pdf/PdfStamperImp.java
+++ b/core/com/lowagie/text/pdf/PdfStamperImp.java
@@ -234,24 +234,9 @@
         	altMetadata = xmpMetadata;
         }
         // if there is XMP data to add: add it
-        PdfDate date = new PdfDate();
         if (altMetadata != null) {
         	PdfStream xmp;
-        	try {
-        		XmpReader xmpr = new XmpReader(altMetadata);
-        		if (!xmpr.replace("http://ns.adobe.com/pdf/1.3/";, "Producer", producer))
-        			xmpr.add("rdf:Description", "http://ns.adobe.com/pdf/1.3/";, "pdf:Producer", producer);
-        		if (!xmpr.replace("http://ns.adobe.com/xap/1.0/";, "ModifyDate", date.getW3CDate()))
-        			xmpr.add("rdf:Description", "http://ns.adobe.com/xap/1.0/";, "xmp:ModifyDate", date.getW3CDate());
-        		xmpr.replace("http://ns.adobe.com/xap/1.0/";, "MetadataDate", date.getW3CDate());
-            	xmp = new PdfStream(xmpr.serializeDoc());
-        	}
-        	catch(SAXException e) {
-        		xmp = new PdfStream(altMetadata);
-        	}
-        	catch(IOException e) {
-        		xmp = new PdfStream(altMetadata);
-        	}
+        	xmp = new PdfStream(altMetadata);
         	xmp.put(PdfName.TYPE, PdfName.METADATA);
         	xmp.put(PdfName.SUBTYPE, PdfName.XML);
         	if (crypto != null && !crypto.isMetadataEncrypted()) {
@@ -341,8 +326,6 @@
                     newInfo.put(keyName, new PdfString(value, PdfObject.TEXT_UNICODE));
             }
         }
-        newInfo.put(PdfName.MODDATE, date);
-        newInfo.put(PdfName.PRODUCER, new PdfString(producer));
         if (append) {
             if (iInfo == null)
                 info = addToBody(newInfo, false).getIndirectReference();
__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers>. 
Please use
debian-j...@lists.debian.org for discussions and questions.

Reply via email to