@@ -176,6 +176,32 @@ public virtual void CreateEmptyDocumentWithAbcXmp() {
176
176
reader . Close ( ) ;
177
177
}
178
178
179
+ /// <exception cref="System.IO.IOException"/>
180
+ /// <exception cref="System.Exception"/>
181
+ [ NUnit . Framework . Test ]
182
+ [ NUnit . Framework . Ignore ( "DEVSIX-1899: fails in .NET passes in Java" ) ]
183
+ public virtual void CustomXmpTest ( ) {
184
+ String xmp = "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='770'?>\n " + "\n " + "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n "
185
+ + " xmlns:iX='http://ns.adobe.com/iX/1.0/'>\n " + "\n " + " <rdf:Description about=''\n " + " xmlns='http://ns.adobe.com/pdf/1.3/'\n "
186
+ + " xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>\n " + " <pdf:ModDate>2001-03-28T15:17:00-08:00</pdf:ModDate>\n "
187
+ + " <pdf:CreationDate>2001-03-28T15:19:45-08:00</pdf:CreationDate>\n " + " </rdf:Description>\n " + "\n "
188
+ + " <rdf:Description about=''\n " + " xmlns='http://ns.adobe.com/xap/1.0/'\n " + " xmlns:xap='http://ns.adobe.com/xap/1.0/'>\n "
189
+ + " <xap:ModifyDate>2001-03-28T15:17:00-08:00</xap:ModifyDate>\n " + " <xap:CreateDate>2001-03-28T15:19:45-08:00</xap:CreateDate>\n "
190
+ + " <xap:MetadataDate>2001-03-28T15:17:00-08:00</xap:MetadataDate>\n " + " </rdf:Description>\n " + "\n "
191
+ + "</rdf:RDF>\n " + "<?xpacket end='r'?>" ;
192
+ String outPath = destinationFolder + "customXmp.pdf" ;
193
+ String cmpPath = sourceFolder + "cmp_customXmp.pdf" ;
194
+ PdfDocument pdfDoc = new PdfDocument ( new PdfWriter ( outPath ) ) ;
195
+ PdfPage page = pdfDoc . AddNewPage ( ) ;
196
+ page . Flush ( ) ;
197
+ pdfDoc . SetXmpMetadata ( xmp . GetBytes ( iText . IO . Util . EncodingUtil . ISO_8859_1 ) ) ;
198
+ pdfDoc . Close ( ) ;
199
+ CompareTool compareTool = new CompareTool ( ) ;
200
+ NUnit . Framework . Assert . IsNull ( compareTool . CompareByContent ( outPath , cmpPath , destinationFolder , "diff_customXmp_"
201
+ ) ) ;
202
+ NUnit . Framework . Assert . IsNull ( compareTool . CompareDocumentInfo ( outPath , cmpPath ) ) ;
203
+ }
204
+
179
205
/// <exception cref="iText.Kernel.XMP.XMPException"/>
180
206
private byte [ ] RemoveAlwaysDifferentEntries ( byte [ ] cmpBytes ) {
181
207
XMPMeta xmpMeta = XMPMetaFactory . ParseFromBuffer ( cmpBytes ) ;
0 commit comments