@@ -181,24 +181,40 @@ public virtual void CreateEmptyDocumentWithAbcXmp() {
181
181
[ NUnit . Framework . Test ]
182
182
[ NUnit . Framework . Ignore ( "DEVSIX-1899: fails in .NET passes in Java" ) ]
183
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" ;
184
+ RunCustomXmpTest ( "customXmp" , "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='770'?>\n " + "\n " +
185
+ "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'\n " + " xmlns:iX='http://ns.adobe.com/iX/1.0/'>\n "
186
+ + "\n " + " <rdf:Description about=''\n " + " xmlns='http://ns.adobe.com/pdf/1.3/'\n " + " xmlns:pdf='http://ns.adobe.com/pdf/1.3/'>\n "
187
+ + " <pdf:ModDate>2001-03-28T15:17:00-08:00</pdf:ModDate>\n " + " <pdf:CreationDate>2001-03-28T15:19:45-08:00</pdf:CreationDate>\n "
188
+ + " </rdf:Description>\n " + "\n " + " <rdf:Description about=''\n " + " xmlns='http://ns.adobe.com/xap/1.0/'\n "
189
+ + " xmlns:xap='http://ns.adobe.com/xap/1.0/'>\n " + " <xap:ModifyDate>2001-03-28T15:17:00-08:00</xap:ModifyDate>\n "
190
+ + " <xap:CreateDate>2001-03-28T15:19:45-08:00</xap:CreateDate>\n " + " <xap:MetadataDate>2001-03-28T15:17:00-08:00</xap:MetadataDate>\n "
191
+ + " </rdf:Description>\n " + "\n " + "</rdf:RDF>\n " + "<?xpacket end='r'?>" ) ;
192
+ }
193
+
194
+ /// <exception cref="System.IO.IOException"/>
195
+ /// <exception cref="System.Exception"/>
196
+ [ NUnit . Framework . Test ]
197
+ [ NUnit . Framework . Ignore ( "DEVSIX-1899: fails in .NET passes in Java" ) ]
198
+ public virtual void CustomXmpTest02 ( ) {
199
+ RunCustomXmpTest ( "customXmp02" , "<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d' bytes='1026'?><rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:iX='http://ns.adobe.com/iX/1.0/'><rdf:Description about='' xmlns='http://ns.adobe.com/pdf/1.3/' xmlns:pdf='http://ns.adobe.com/pdf/1.3/' pdf:CreationDate='2016-01-27T13:07:23Z' pdf:ModDate='2016-01-27T13:07:23Z' pdf:Producer='Acrobat Distiller 5.0.5 (Windows)' pdf:Author='Koeck' pdf:Creator='PScript5.dll Version 5.2.2' pdf:Title='Rasant_ACE.indd'/>\n "
200
+ + "<rdf:Description about='' xmlns='http://ns.adobe.com/xap/1.0/' xmlns:xap='http://ns.adobe.com/xap/1.0/' xap:CreateDate='2016-01-27T13:07:23Z' xap:ModifyDate='2016-01-27T13:07:23Z' xap:Author='Koeck' xap:MetadataDate='2016-01-27T13:07:23Z'><xap:Title><rdf:Alt><rdf:li xml:lang='x-default'>Rasant_ACE.indd</rdf:li></rdf:Alt></xap:Title></rdf:Description>\n "
201
+ + "<rdf:Description about='' xmlns='http://purl.org/dc/elements/1.1/' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:creator='Koeck' dc:title='Rasant_ACE.indd'/>\n "
202
+ + "</rdf:RDF><?xpacket end='r'?>" ) ;
203
+ }
204
+
205
+ /// <exception cref="System.IO.IOException"/>
206
+ /// <exception cref="System.Exception"/>
207
+ private void RunCustomXmpTest ( String name , String xmp ) {
208
+ String outPath = destinationFolder + name + ".pdf" ;
209
+ String cmpPath = sourceFolder + "cmp_" + name + ".pdf" ;
194
210
PdfDocument pdfDoc = new PdfDocument ( new PdfWriter ( outPath ) ) ;
195
211
PdfPage page = pdfDoc . AddNewPage ( ) ;
196
212
page . Flush ( ) ;
197
213
pdfDoc . SetXmpMetadata ( xmp . GetBytes ( iText . IO . Util . EncodingUtil . ISO_8859_1 ) ) ;
198
214
pdfDoc . Close ( ) ;
199
215
CompareTool compareTool = new CompareTool ( ) ;
200
- NUnit . Framework . Assert . IsNull ( compareTool . CompareByContent ( outPath , cmpPath , destinationFolder , "diff_customXmp_"
201
- ) ) ;
216
+ NUnit . Framework . Assert . IsNull ( compareTool . CompareByContent ( outPath , cmpPath , destinationFolder , "diff_" +
217
+ name + "_" ) ) ;
202
218
NUnit . Framework . Assert . IsNull ( compareTool . CompareDocumentInfo ( outPath , cmpPath ) ) ;
203
219
}
204
220
0 commit comments