if (update.size() != exclusionLocations.size()) throw new IllegalArgumentException("The update dictionary has less keys than required"); if (tempFile == null) {
if (update.size() != exclusionLocations.size()) throw new IllegalArgumentException("The update dictionary has less keys than required"); if (tempFile == null) {
/** * This method removes all widget annotation entries from the form field the given annotation merged with. */ public void releaseFormFieldFromWidgetAnnotation(){ PdfDictionary annotDict = getPdfObject(); for (PdfName entry: widgetEntries) { annotDict.remove(entry); } PdfDictionary parent = annotDict.getAsDictionary(PdfName.Parent); if (parent != null && annotDict.size() == 1) { PdfArray kids = parent.getAsArray(PdfName.Kids); kids.remove(annotDict); if (kids.size() == 0) { parent.remove(PdfName.Kids); } } } /**
public static PdfStructureAttributes getTableAttributes(AbstractRenderer renderer, TagTreePointer taggingPointer) { IRoleMappingResolver resolvedMapping = resolveMappingToStandard(taggingPointer); if (resolvedMapping == null || !StandardRoles.TD.equals(resolvedMapping.getRole()) && !StandardRoles.TH.equals(resolvedMapping.getRole())) { return null; } PdfDictionary attributes = new PdfDictionary(); attributes.put(PdfName.O, PdfName.Table); if (renderer.getModelElement() instanceof Cell) { Cell cell = (Cell) renderer.getModelElement(); if (cell.getRowspan() != 1) { attributes.put(PdfName.RowSpan, new PdfNumber(cell.getRowspan())); } if (cell.getColspan() != 1) { attributes.put(PdfName.ColSpan, new PdfNumber(cell.getColspan())); } } return attributes.size() > 1 ? new PdfStructureAttributes(attributes) : null; }
public static PdfStructureAttributes getTableAttributes(AbstractRenderer renderer, TagTreePointer taggingPointer) { IRoleMappingResolver resolvedMapping = resolveMappingToStandard(taggingPointer); if (resolvedMapping == null || !StandardRoles.TD.equals(resolvedMapping.getRole()) && !StandardRoles.TH.equals(resolvedMapping.getRole())) { return null; } PdfDictionary attributes = new PdfDictionary(); attributes.put(PdfName.O, PdfName.Table); if (renderer.getModelElement() instanceof Cell) { Cell cell = (Cell) renderer.getModelElement(); if (cell.getRowspan() != 1) { attributes.put(PdfName.RowSpan, new PdfNumber(cell.getRowspan())); } if (cell.getColspan() != 1) { attributes.put(PdfName.ColSpan, new PdfNumber(cell.getColspan())); } } return attributes.size() > 1 ? new PdfStructureAttributes(attributes) : null; }
public static PdfStructureAttributes getListAttributes(AbstractRenderer renderer, TagTreePointer taggingPointer) { IRoleMappingResolver resolvedMapping = null; resolvedMapping = resolveMappingToStandard(taggingPointer); if (resolvedMapping == null || !StandardRoles.L.equals(resolvedMapping.getRole())) { return null; } PdfDictionary attributes = new PdfDictionary(); attributes.put(PdfName.O, PdfName.List); Object listSymbol = renderer.<Object>getProperty(Property.LIST_SYMBOL); boolean tagStructurePdf2 = isTagStructurePdf2(resolvedMapping.getNamespace()); if (listSymbol instanceof ListNumberingType) { ListNumberingType numberingType = (ListNumberingType) listSymbol; attributes.put(PdfName.ListNumbering, transformNumberingTypeToName(numberingType, tagStructurePdf2)); } else if (tagStructurePdf2) { if (listSymbol instanceof IListSymbolFactory) { attributes.put(PdfName.ListNumbering, PdfName.Ordered); } else { attributes.put(PdfName.ListNumbering, PdfName.Unordered); } } return attributes.size() > 1 ? new PdfStructureAttributes(attributes) : null; }
public static PdfStructureAttributes getListAttributes(AbstractRenderer renderer, TagTreePointer taggingPointer) { IRoleMappingResolver resolvedMapping = null; resolvedMapping = resolveMappingToStandard(taggingPointer); if (resolvedMapping == null || !StandardRoles.L.equals(resolvedMapping.getRole())) { return null; } PdfDictionary attributes = new PdfDictionary(); attributes.put(PdfName.O, PdfName.List); Object listSymbol = renderer.<Object>getProperty(Property.LIST_SYMBOL); boolean tagStructurePdf2 = isTagStructurePdf2(resolvedMapping.getNamespace()); if (listSymbol instanceof ListNumberingType) { ListNumberingType numberingType = (ListNumberingType) listSymbol; attributes.put(PdfName.ListNumbering, transformNumberingTypeToName(numberingType, tagStructurePdf2)); } else if (tagStructurePdf2) { if (listSymbol instanceof IListSymbolFactory) { attributes.put(PdfName.ListNumbering, PdfName.Ordered); } else { attributes.put(PdfName.ListNumbering, PdfName.Unordered); } } return attributes.size() > 1 ? new PdfStructureAttributes(attributes) : null; }
public static PdfStructureAttributes getLayoutAttributes(AbstractRenderer renderer, TagTreePointer taggingPointer) { IRoleMappingResolver resolvedMapping = resolveMappingToStandard(taggingPointer); if (resolvedMapping == null) { return null; } String role = resolvedMapping.getRole(); int tagType = AccessibleTypes.identifyType(role); PdfDictionary attributes = new PdfDictionary(); attributes.put(PdfName.O, PdfName.Layout); //TODO WritingMode attribute applying when needed applyCommonLayoutAttributes(renderer, attributes); if (tagType == AccessibleTypes.BlockLevel) { applyBlockLevelLayoutAttributes(role, renderer, attributes); } if (tagType == AccessibleTypes.InlineLevel) { applyInlineLevelLayoutAttributes(renderer, attributes); } if (tagType == AccessibleTypes.Illustration) { applyIllustrationLayoutAttributes(renderer, attributes); } return attributes.size() > 1 ? new PdfStructureAttributes(attributes) : null; }
public static PdfStructureAttributes getLayoutAttributes(AbstractRenderer renderer, TagTreePointer taggingPointer) { IRoleMappingResolver resolvedMapping = resolveMappingToStandard(taggingPointer); if (resolvedMapping == null) { return null; } String role = resolvedMapping.getRole(); int tagType = AccessibleTypes.identifyType(role); PdfDictionary attributes = new PdfDictionary(); attributes.put(PdfName.O, PdfName.Layout); //TODO WritingMode attribute applying when needed applyCommonLayoutAttributes(renderer, attributes); if (tagType == AccessibleTypes.BlockLevel) { applyBlockLevelLayoutAttributes(role, renderer, attributes); } if (tagType == AccessibleTypes.InlineLevel) { applyInlineLevelLayoutAttributes(renderer, attributes); } if (tagType == AccessibleTypes.Illustration) { applyIllustrationLayoutAttributes(renderer, attributes); } return attributes.size() > 1 ? new PdfStructureAttributes(attributes) : null; }