@Test
public void deprecatedLogicTest() throws IOException, DocumentException {

    String fileName = "xmp_metadata_deprecated.pdf";
    // step 1
    Document document = new Document();
    // step 2
    PdfWriter writer = PdfAWriter.getInstance(document, new FileOutputStream(OUT_FOLDER + fileName), PdfAConformanceLevel.PDF_A_2B);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    XmpWriter xmp = new PdfAXmpWriter(os, PdfAConformanceLevel.PDF_A_2B, writer);
    XmpSchema dc = new com.itextpdf.text.xml.xmp.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.getXmlns(), dc.toString());
    PdfSchema pdf = new PdfSchema();
    pdf.setProperty(PdfSchema.KEYWORDS, "Hello World, XMP & Metadata, Metadata");
    pdf.setProperty(PdfSchema.VERSION, "1.4");
    xmp.addRdfDescription(pdf);
    xmp.close();
    writer.setXmpMetadata(os.toByteArray());
    // step 3
    document.open();
    document.addLanguage("en_US");
    // step 4
    Font font = FontFactory.getFont("./src/test/resources/com/itextpdf/text/pdf/FreeMonoBold.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED, 12);
    document.add(new Paragraph("Hello World", font));
    ICC_Profile icc = ICC_Profile.getInstance(new FileInputStream("./src/test/resources/com/itextpdf/text/pdf/sRGB Color Space Profile.icm"));
    writer.setOutputIntents("Custom", "", "http://www.color.org", "sRGB IEC61966-2.1", icc);
    // step 5
    document.close();
    CompareTool ct = new CompareTool();
    Assert.assertNull(ct.compareXmp(OUT_FOLDER + fileName, CMP_FOLDER + "xmp_metadata_deprecated.pdf", true));
}