@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."); }
@Override public void addPage(PdfImportedPage iPage) throws IOException, BadPdfFormatException { checkPdfAInfo(iPage.readerInstance.getReader()); super.addPage(iPage); }
PdfACopy extends PdfCopy { @Override public void addPage(PdfImportedPage iPage) throws IOException, BadPdfFormatException { checkPdfAInfo(iPage.readerInstance.getReader()); super.addPage(iPage); } }
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); }
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(); }
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();  }