private static void validateRemoteDestination(PdfDestination destination) { // No page object can be specified for a destination associated with a remote go-to action because the // destination page is in a different PDF document. In this case, the page parameter specifies an integer // page number within the remote document instead of a page object in the current document. // See section 12.3.2.2 of ISO 32000-1. if (destination instanceof PdfExplicitDestination) { PdfObject firstObj = ((PdfArray)destination.getPdfObject()).get(0); if (firstObj.isDictionary()) { throw new IllegalArgumentException("Explicit destinations shall specify page number in remote go-to actions instead of page dictionary"); } } else if (destination instanceof PdfStructureDestination) { // No structure element dictionary can be specified for a structure destination associated with a remote // go-to action because the destination structure element is in a // different PDF document. In this case, the indirect reference to the structure element dictionary shall be // replaced by a byte string representing a structure element ID PdfObject firstObj = ((PdfArray)destination.getPdfObject()).get(0); if (firstObj.isDictionary()) { PdfDictionary structElemObj = (PdfDictionary)firstObj; PdfString id = structElemObj.getAsString(PdfName.ID); if (id == null) { throw new IllegalArgumentException("Structure destinations shall specify structure element ID in remote go-to actions. Structure element that has no ID is specified instead"); } else { LoggerFactory.getLogger(PdfAction.class).warn(LogMessageConstant.STRUCTURE_ELEMENT_REPLACED_BY_ITS_ID_IN_STRUCTURE_DESTINATION); ((PdfArray)destination.getPdfObject()).set(0, id); destination.getPdfObject().setModified(); } } } }
if (lastPdfPages == null) { // possible if only first kid is PdfPage lastPdfPages = new PdfPages(parent.getFrom(), document, parent); kids.set(i, lastPdfPages.getPdfObject()); newParents.add(lastPdfPages); } else {
copiedArray.set(0, page2page.get(oldPage).getPdfObject()); toDocument.addNamedDestination(srcDestName, copiedArray);
((PdfArray) colorSpaceObject).set(1, iccBasedColorSpace); iccProfileShouldBeApplied = false;
PdfObject obj = parentKids.get(i); if (obj == existingField.getPdfObject()) { parentKids.set(i, mergedField.getPdfObject()); break;
PdfObject obj = parentKids.get(i); if (obj == existingField.getPdfObject()) { parentKids.set(i, mergedField.getPdfObject()); break;