public void addRoleMapping(String fromRole, String toRole) { PdfDictionary roleMap = getRoleMap(); PdfObject prevVal = roleMap.put(convertRoleToPdfName(fromRole), convertRoleToPdfName(toRole)); if (prevVal != null && prevVal instanceof PdfName) { Logger logger = LoggerFactory.getLogger(PdfStructTreeRoot.class); logger.warn(MessageFormat.format(LogMessageConstant.MAPPING_IN_STRUCT_ROOT_OVERWRITTEN, fromRole, prevVal, toRole)); } if (roleMap.isIndirect()) { roleMap.setModified(); } else { setModified(); } }
public static PdfFileSpec wrap(PdfDictionary dictionary) { if (!PdfName.EncryptedPayload.equals(dictionary.getAsName(PdfName.AFRelationship))) { LoggerFactory.getLogger(PdfEncryptedPayloadFileSpecFactory.class).error(LogMessageConstant.ENCRYPTED_PAYLOAD_FILE_SPEC_SHALL_HAVE_AFRELATIONSHIP_FILED_EQUAL_TO_ENCRYPTED_PAYLOAD); } PdfDictionary ef = dictionary.getAsDictionary(PdfName.EF); if (ef == null || (ef.getAsStream(PdfName.F) == null) && (ef.getAsStream(PdfName.UF) == null)) { throw new PdfException(PdfException.EncryptedPayloadFileSpecShallHaveEFDictionary); } if (!PdfName.Filespec.equals(dictionary.getAsName(PdfName.Type))) { throw new PdfException(PdfException.EncryptedPayloadFileSpecShallHaveTypeEqualToFilespec); } if (!dictionary.isIndirect()) { throw new PdfException(PdfException.EncryptedPayloadFileSpecShallBeIndirect); } PdfFileSpec fileSpec = PdfFileSpec.wrapFileSpecObject(dictionary); if (PdfEncryptedPayload.extractFrom(fileSpec) == null) { throw new PdfException(PdfException.EncryptedPayloadFileSpecDoesntHaveEncryptedPayloadDictionary); } return fileSpec; }
PdfMcr mcr = entry.getValue(); PdfDictionary parentObj = ((PdfStructElem) mcr.getParent()).getPdfObject(); if (!parentObj.isIndirect()) { continue;
/** * A {@link PdfName#Ref} identifies the structure element to which the item of content, contained * within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.). * <p>This value has meaning only for the PDF documents of version <b>2.0 and higher</b>.</p> * * @param ref a {@link PdfStructElem} to which the item of content, contained within this structure element, refers. */ public void addRef(PdfStructElem ref) { if (!ref.getPdfObject().isIndirect()) { throw new PdfException(PdfException.RefArrayItemsInStructureElementDictionaryShallBeIndirectObjects); } VersionConforming.validatePdfVersionForDictEntry(getDocument(), PdfVersion.PDF_2_0, PdfName.Ref, PdfName.StructElem); PdfArray refsArray = getPdfObject().getAsArray(PdfName.Ref); if (refsArray == null) { refsArray = new PdfArray(); put(PdfName.Ref, refsArray); } refsArray.add(ref.getPdfObject()); setModified(); }
acroForm.addField(sigField, document.getPage(pagen)); if (acroForm.getPdfObject().isIndirect()) { acroForm.setModified(); } else {
acroForm.addField(sigField, document.getPage(pagen)); if (acroForm.getPdfObject().isIndirect()) { acroForm.setModified(); } else {
acroForm.put(PdfName.XFA, new PdfArray(ar)); acroForm.setModified(); if (!acroForm.getPdfObject().isIndirect()) { document.getCatalog().setModified(); acroForm.put(PdfName.XFA, stream); acroForm.setModified(); if (!acroForm.getPdfObject().isIndirect()) { document.getCatalog().setModified();
acroForm.put(PdfName.XFA, new PdfArray(ar)); acroForm.setModified(); if (!acroForm.getPdfObject().isIndirect()) { document.getCatalog().setModified(); acroForm.put(PdfName.XFA, stream); acroForm.setModified(); if (!acroForm.getPdfObject().isIndirect()) { document.getCatalog().setModified();
if (!parent.isIndirect()) { throw new PdfException(PdfException.StructureElementDictionaryShallBeAnIndirectObjectInOrderToHaveChildren);
if (source.isIndirect()) { copied.makeIndirect(copyingParams.getToDocument());