### Question:
PdfACopy extends PdfCopy { @Override public void addPage(PdfImportedPage iPage) throws IOException, BadPdfFormatException { checkPdfAInfo(iPage.readerInstance.getReader()); super.addPage(iPage); } PdfACopy(Document document, OutputStream os, PdfAConformanceLevel conformanceLevel); @Override void addDocument(PdfReader reader); @Override void addPage(PdfImportedPage iPage); @Override PageStamp createPageStamp(PdfImportedPage iPage); @Override void setOutputIntents(final String outputConditionIdentifier, final String outputCondition, final String registryName, final String info, final ICC_Profile colorProfile); @Override boolean setOutputIntents(PdfReader reader, boolean checkExistence); @Override void close();  }### Answer:
@Test public void testImportedPage2() throws DocumentException, IOException { String f1 = "./src/test/resources/com/itextpdf/text/pdf/copy/pdfa-1a.pdf"; String f2 = "./src/test/resources/com/itextpdf/text/pdf/copy/pdfa-1a-2.pdf"; String f3 = "./src/test/resources/com/itextpdf/text/pdf/copy/pdfa-2a.pdf"; OutputStream outputPdfStream = new ByteArrayOutputStream(); Document document = new Document(); PdfACopy copy = new PdfACopy(document, outputPdfStream, PdfAConformanceLevel.PDF_A_1A); copy.createXmpMetadata(); copy.setTagged(); document.open(); document.addLanguage("en-US"); boolean exceptionThrown = false; try { for (String f : new String[]{f1, f2, f3}) { PdfReader reader = new PdfReader(f); for (int i = 1; i <= reader.getNumberOfPages(); i++) { copy.addPage(copy.getImportedPage(reader, i, true)); } } } catch (PdfAConformanceException e) { if (e.getMessage().contains("Different PDF/A version")) exceptionThrown = true; } if (!exceptionThrown) junit.framework.Assert.fail("PdfAConformanceException should be thrown."); }
@Test public void testImportedPage6() throws DocumentException, IOException { String f1 = "./src/test/resources/com/itextpdf/text/pdf/copy/pdfa-3a.pdf"; String f2 = "./src/test/resources/com/itextpdf/text/pdf/copy/pdfa-3u.pdf"; String f3 = "./src/test/resources/com/itextpdf/text/pdf/copy/pdfa-3b.pdf"; String testName = "testImportedPage5.pdf"; OutputStream outputPdfStream = new ByteArrayOutputStream(); Document document = new Document(); PdfACopy copy = new PdfACopy(document, outputPdfStream, PdfAConformanceLevel.PDF_A_3U); copy.createXmpMetadata(); document.open(); boolean exceptionThrown = false; try { for (String f : new String[]{f1, f2, f3}) { PdfReader reader = new PdfReader(f); for (int i = 1; i <= reader.getNumberOfPages(); i++) { copy.addPage(copy.getImportedPage(reader, i)); } } } catch (PdfAConformanceException e) { if (e.getMessage().contains("Incompatible PDF/A conformance level")) exceptionThrown = true; } if (!exceptionThrown) junit.framework.Assert.fail("PdfAConformanceException should be thrown."); }