private static String optionsArrayToString(PdfArray options) { StringBuffer stringBuffer = new StringBuffer(); for (PdfObject obj : options) { if (obj.isString()) { stringBuffer.append(((PdfString) obj).toUnicodeString()).append('\n'); } else if (obj.isArray()) { PdfObject element = ((PdfArray) obj).get(1); if (element.isString()) { stringBuffer.append(((PdfString) element).toUnicodeString()).append('\n'); } } } stringBuffer.deleteCharAt(stringBuffer.length() - 1); // last '\n' return stringBuffer.toString(); }
private static String optionsArrayToString(PdfArray options) { StringBuffer stringBuffer = new StringBuffer(); for (PdfObject obj : options) { if (obj.isString()) { stringBuffer.append(((PdfString) obj).toUnicodeString()).append('\n'); } else if (obj.isArray()) { PdfObject element = ((PdfArray) obj).get(1); if (element.isString()) { stringBuffer.append(((PdfString) element).toUnicodeString()).append('\n'); } } } stringBuffer.deleteCharAt(stringBuffer.length() - 1); // last '\n' return stringBuffer.toString(); }
public static PdfFileSpec wrapFileSpecObject(PdfObject fileSpecObject) { if (fileSpecObject != null) { if (fileSpecObject.isString()) { return new PdfStringFS((PdfString) fileSpecObject); } else if (fileSpecObject.isDictionary()) { return new PdfDictionaryFS((PdfDictionary) fileSpecObject); } } return null; }
if (pdfObject.isArray()) { valStr = ((PdfArray) pdfObject).getAsString(1); } else if (pdfObject.isString()) { valStr = (PdfString) pdfObject;
if (pdfObject.isArray()) { valStr = ((PdfArray) pdfObject).getAsString(1); } else if (pdfObject.isString()) { valStr = (PdfString) pdfObject;
} else if (obj.isArray()) { serArray((PdfArray) obj, bb, level - 1, serializedCache); } else if (obj.isString()) { bb.append("$S").append(obj.toString()); // TODO specify length for strings, streams, may be names? } else if (obj.isName()) {
} else if (dest.isString() || dest.isName()) { PdfNameTree destsTree = getNameTree(PdfName.Dests); Map<String, PdfObject> dests = destsTree.getNames(); String srcDestName = dest.isString() ? ((PdfString) dest).toUnicodeString() : ((PdfName) dest).getValue(); PdfArray srcDestArray = (PdfArray) dests.get(srcDestName); if (srcDestArray != null) {
if (obj == null) continue; if (obj.isString()) { value = ((PdfString) obj).toUnicodeString(); } else if (obj.isName()) {
if (!compareNumbersExtended((PdfNumber) outDirectObj, (PdfNumber) cmpDirectObj, currentPath, compareResult)) return false; } else if (cmpDirectObj.isString()) { if (!compareStringsExtended((PdfString) outDirectObj, (PdfString) cmpDirectObj, currentPath, compareResult)) return false;
PdfObject option = options.get(index); PdfString value = null; if (option.isString()) { value = (PdfString) option; } else if (option.isArray()) {
PdfObject option = options.get(index); PdfString value = null; if (option.isString()) { value = (PdfString) option; } else if (option.isArray()) {
/** * Shows text (operator TJ) * * @param textArray the text array. Each element of array can be a string or a number. * If the element is a string, this operator shows the string. * If it is a number, the operator adjusts the text position by that amount. * The number is expressed in thousandths of a unit of text space. * This amount is subtracted from the current horizontal or vertical coordinate, depending on the writing mode. * @return current canvas. */ public PdfCanvas showText(PdfArray textArray) { if (currentGs.getFont() == null) throw new PdfException(PdfException.FontAndSizeMustBeSetBeforeWritingAnyText, currentGs); contentStream.getOutputStream().writeBytes(ByteUtils.getIsoBytes("[")); for (PdfObject obj : textArray) { if (obj.isString()) { StreamUtil.writeEscapedString(contentStream.getOutputStream(), ((PdfString) obj).getValueBytes()); } else if (obj.isNumber()) { contentStream.getOutputStream().writeFloat(((PdfNumber) obj).floatValue()); } } contentStream.getOutputStream().writeBytes(ByteUtils.getIsoBytes("]")); contentStream.getOutputStream().writeBytes(TJ); return this; }
indices.add(new PdfNumber(number)); PdfObject option = options.get(number); if (option.isString()) { values.add(option); } else if (option.isArray()) {
indices.add(new PdfNumber(number)); PdfObject option = options.get(number); if (option.isString()) { values.add(option); } else if (option.isArray()) {