List of usage examples for org.apache.pdfbox.cos COSInteger intValue
@Override public int intValue()
From source file:org.apache.fop.render.pdf.pdfbox.PDFWriter.java
License:Apache License
private void updateMCID(Map.Entry<COSName, COSBase> cn, Collection<COSBase> dictArgs) { COSBase cosMCID = cn.getValue();/*from w ww. j av a 2 s . com*/ assert cosMCID instanceof COSInteger; COSInteger mcid = (COSInteger) cosMCID; COSInteger updatedID = COSInteger.get(mcid.intValue() + currentMCID); dictArgs.add(cn.getKey()); dictArgs.add(updatedID); }
From source file:org.xmlcml.pdf2svg.AMIFont.java
License:Apache License
public static String getFontName(COSDictionary dict) { String fontName = null;/*from www . ja v a 2s.c o m*/ String baseFontS = null; for (COSName key : dict.keySet()) { String keyName = key.getName(); if (keyName == null) { LOG.error("Null key"); continue; } else if (!(key instanceof COSName)) { LOG.error("key not COSName"); continue; } String cosNameName = null; COSBase cosBase = dict.getDictionaryObject(key); if (cosBase instanceof COSName) { COSName cosName = (COSName) cosBase; cosNameName = cosName.getName(); LOG.trace("Name:" + cosNameName); } else if (cosBase instanceof COSInteger) { COSInteger cosInteger = (COSInteger) cosBase; LOG.trace("Integer: " + cosInteger.intValue()); } else if (cosBase instanceof COSArray) { COSArray cosArray = (COSArray) cosBase; LOG.trace("Array: " + cosArray.size() + " / " + cosArray); } else if (cosBase instanceof COSDictionary) { COSDictionary cosDictionary = (COSDictionary) cosBase; LOG.trace("Dictionary: " + cosDictionary); } else { LOG.error("COS " + cosBase); } if (cosNameName != null && keyName.equals(N_NAME)) { fontName = cosNameName; } else if (cosNameName != null && keyName.equals(N_BASE_FONT)) { baseFontS = cosNameName; } } if (fontName == null) { fontName = baseFontS; } return fontName; }