Refine search
/** * {@inheritDoc} */ @Override public void add(int index, E element) { //when adding if there is a parentDict then change the item //in the dictionary from a single item to an array. if( parentDict != null ) { parentDict.setItem( dictKey, array ); //clear the parent dict so it doesn't happen again, there might be //a usecase for keeping the parentDict around but not now. parentDict = null; } actual.add( index, element ); if( element instanceof String ) { array.add( index, new COSString( (String)element ) ); } else { array.add( index, ((COSObjectable)element).getCOSObject() ); } }
/** * Sets the dictionary's "Doc" entry. * * @param map Map of named "JavaScript" dictionaries. */ public void setDoc(Map<String, PDActionJavaScript> map) { COSArray array = new COSArray(); for (Map.Entry<String, PDActionJavaScript> entry : map.entrySet()) { array.add(new COSString(entry.getKey())); array.add(entry.getValue()); } dictionary.setItem(COSName.DOC, array); } }
/** * {@inheritDoc} */ @Override public boolean add(E o) { //when adding if there is a parentDict then change the item //in the dictionary from a single item to an array. if( parentDict != null ) { parentDict.setItem( dictKey, array ); //clear the parent dict so it doesn't happen again, there might be //a usecase for keeping the parentDict around but not now. parentDict = null; } //string is a special case because we can't subclass to be COSObjectable if( o instanceof String ) { array.add( new COSString( (String)o ) ); } else { if(array != null) { array.add(((COSObjectable)o).getCOSObject()); } } return actual.add(o); }
/** * Creates a new uncolored tiling pattern color space. * * @param resources The current resources. * @param colorSpace The underlying color space. */ public PDPattern(PDResources resources, PDColorSpace colorSpace) { this.resources = resources; this.underlyingColorSpace = colorSpace; array = new COSArray(); array.add(COSName.PATTERN); array.add(colorSpace); }
/** * Adds the given page to this page tree. * * @param page The page to add. */ public void add(PDPage page) { // set parent COSDictionary node = page.getCOSObject(); node.setItem(COSName.PARENT, root); // todo: re-balance tree? (or at least group new pages into tree nodes of e.g. 20) // add to parent's kids COSArray kids = (COSArray)root.getDictionaryObject(COSName.KIDS); kids.add(node); // update ancestor counts do { node = (COSDictionary) node.getDictionaryObject(COSName.PARENT, COSName.P); if (node != null) { node.setInt(COSName.COUNT, node.getInt(COSName.COUNT) + 1); } } while (node != null); }
/** * This will set the changes along the y-axis. * * @param changeYs changes along the y-axis */ public void setChangeYs(PDNumberFormatDictionary[] changeYs) { COSArray array = new COSArray(); for (PDNumberFormatDictionary changeY : changeYs) { array.add(changeY); } this.getCOSObject().setItem("Y", array); }
/** * This will set the sloaps of a line. * * @param lineSloaps the sloaps of a line */ public void setLineSloaps(PDNumberFormatDictionary[] lineSloaps) { COSArray array = new COSArray(); for (PDNumberFormatDictionary lineSloap : lineSloaps) { array.add(lineSloap); } this.getCOSObject().setItem("S", array); }