/** * Defines the sort order of the field (ascending or descending). * * @param ascending true is the default, use false for descending order */ public PdfCollectionSort setSortOrder(boolean ascending) { PdfObject obj = getPdfObject().get(PdfName.S); if (obj.isName()) { getPdfObject().put(PdfName.A, PdfBoolean.valueOf(ascending)); } else { throw new PdfException(PdfException.YouHaveToDefineABooleanArrayForThisCollectionSortDictionary); } return this; }
if (key.equals(PdfName.BaseFont) || key.equals(PdfName.FontName)) { PdfObject cmpObj = cmpDict.get(key); if (cmpObj != null && cmpObj.isName() && cmpObj.toString().indexOf('+') > 0) { PdfObject outObj = outDict.get(key); if (!outObj.isName() || outObj.toString().indexOf('+') == -1) { if (compareResult != null && currentPath != null) compareResult.addError(currentPath, MessageFormatUtil.format("PdfDictionary {0} entry: Expected: {1}. Found: {2}", key.toString(), cmpObj.toString(), outObj.toString()));
} else if (obj.isString()) { bb.append("$S").append(obj.toString()); // TODO specify length for strings, streams, may be names? } else if (obj.isName()) { bb.append("$N").append(obj.toString()); } else {
if (mapping.isName()) { currRole = (PdfName) mapping; currNamespace = defaultNamespace;
if (obj.isString()) { value = ((PdfString) obj).toUnicodeString(); } else if (obj.isName()) { value = ((PdfName)obj).getValue(); } else {
PdfObject toUnicode = fontDictionary.get(PdfName.ToUnicode); CMapToUnicode toUnicodeCMap = FontUtil.processToUnicode(toUnicode); if (cmap.isName() && (PdfEncodings.IDENTITY_H.equals(((PdfName) cmap).getValue()) || PdfEncodings.IDENTITY_V.equals(((PdfName) cmap).getValue()))) { if (toUnicodeCMap == null) { String uniMap = getUniMapFromOrdering(getOrdering(cidFont));
} else if (dest.isString() || dest.isName()) { PdfNameTree destsTree = getNameTree(PdfName.Dests); Map<String, PdfObject> dests = destsTree.getNames();
public static FontEncoding createDocFontEncoding(PdfObject encoding, CMapToUnicode toUnicode) { if (encoding != null) { if (encoding.isName()) { return FontEncoding.createFontEncoding(((PdfName) encoding).getValue()); } else if (encoding.isDictionary()) { DocFontEncoding fontEncoding = new DocFontEncoding(); fontEncoding.differences = new String[256]; fillBaseEncoding(fontEncoding, ((PdfDictionary) encoding).getAsName(PdfName.BaseEncoding)); fillDifferences(fontEncoding, ((PdfDictionary) encoding).getAsArray(PdfName.Differences), toUnicode); return fontEncoding; } } if (toUnicode != null) { DocFontEncoding fontEncoding = new DocFontEncoding(); fontEncoding.differences = new String[256]; fillDifferences(fontEncoding, toUnicode); return fontEncoding; } else { return FontEncoding.createFontSpecificEncoding(); } }
if (!compareArraysExtended((PdfArray) outDirectObj, (PdfArray) cmpDirectObj, currentPath, compareResult)) return false; } else if (cmpDirectObj.isName()) { if (!compareNamesExtended((PdfName) outDirectObj, (PdfName) cmpDirectObj, currentPath, compareResult)) return false;
if (pdfObject.isName()) { if (PdfName.DeviceGray.equals(pdfObject)) { return new DeviceGray(getColorants(operands)[0]);