private String toUnicodeString(PdfString pdfString) { return pdfString != null ? pdfString.toUnicodeString() : null; } }
private static void appendSyntaxString(PdfString string) { stringBuilder .append("(") .append(string.toUnicodeString()) .append(")"); }
private String getPropertyAsString(PdfName name) { PdfString text = properties.getAsString(name); String result = null; if (text != null) { result = text.toUnicodeString(); } return result; }
private String getStringValue(PdfName name) { PdfString pdfString = infoDictionary.getAsString(name); return pdfString != null ? pdfString.toUnicodeString() : null; }
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(); }
@Override public PdfObject getDestinationPage(Map<String, PdfObject> names) { PdfArray array = (PdfArray) names.get(((PdfString)getPdfObject()).toUnicodeString()); return array != null ? array.get(0) : null; }
/** * Gets the string defining the namespace name. * @return a {@link String} defining the namespace name (conventionally a uniform * resource identifier, or URI). */ public String getNamespaceName() { PdfString ns = getPdfObject().getAsString(PdfName.NS); return ns != null ? ns.toUnicodeString() : null; }
/** * PDF 2.0. A language identifier overriding the document’s language identifier to * specify the natural language for all text in the annotation except where overridden by * other explicit language specifications * * @return the lang entry */ public String getLang() { PdfString lang = getPdfObject().getAsString(PdfName.Lang); return lang != null ? lang.toUnicodeString() : null; }
/** * Gets the /Location entry value. * @return physical location of signing. */ public String getLocation() { PdfString locationStr = getPdfObject().getAsString(PdfName.Location); return locationStr != null ? locationStr.toUnicodeString() : null; }
/** * Gets the /Location entry value. * @return physical location of signing. */ public String getLocation() { PdfString locationStr = getPdfObject().getAsString(PdfName.Location); return locationStr != null ? locationStr.toUnicodeString() : null; }
public String getReason() { PdfString reasonStr = getPdfObject().getAsString(PdfName.Reason); return reasonStr != null ? reasonStr.toUnicodeString() : null; }
public String getValueFormattedRepresentation() { PdfString f = getPdfObject().getAsString(PdfName.F); return f != null ? f.toUnicodeString() : null; }
public String getValueAsText() { PdfString str = getPdfObject().getAsString(PdfName.V); return str != null ? str.toUnicodeString() : null; }
public String getName() { return getPdfObject().getAsString(PdfName.N).toUnicodeString(); }
public String getReason() { PdfString reasonStr = getPdfObject().getAsString(PdfName.Reason); return reasonStr != null ? reasonStr.toUnicodeString() : null; }
public String getAttributeAsText(String attributeName) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); PdfString attrVal = getPdfObject().getAsString(name); return attrVal != null ? attrVal.toUnicodeString() : null; }
private LineSegment getUnscaledBaselineWithOffset(float yOffset) { checkGraphicsState(); // we need to correct the width so we don't have an extra character and word spaces at the end. The extra character and word spaces // are important for tracking relative text coordinate systems, but should not be part of the baseline String unicodeStr = string.toUnicodeString(); float correctedUnscaledWidth = getUnscaledWidth() - (gs.getCharSpacing() + (unicodeStr.length() > 0 && unicodeStr.charAt(unicodeStr.length() - 1) == ' ' ? gs.getWordSpacing() : 0)) * (gs.getHorizontalScaling() / 100f); return new LineSegment(new Vector(0, yOffset, 1), new Vector(correctedUnscaledWidth, yOffset, 1)); }
/** * gets the /Name of the person signing the document. * @return name of the person signing the document. */ public String getName() { PdfString nameStr = getPdfObject().getAsString(PdfName.Name); PdfName nameName = getPdfObject().getAsName(PdfName.Name); if (nameStr != null) { return nameStr.toUnicodeString(); } else { return nameName != null ? nameName.getValue() : null; } }
/** * gets the /Name of the person signing the document. * @return name of the person signing the document. */ public String getName() { PdfString nameStr = getPdfObject().getAsString(PdfName.Name); PdfName nameName = getPdfObject().getAsName(PdfName.Name); if (nameStr != null) { return nameStr.toUnicodeString(); } else { return nameName != null ? nameName.getValue() : null; } }
private void updateProducerInInfoDictionary() { String producer = null; if (reader == null) { producer = versionInfo.getVersion(); } else { if (info.getPdfObject().containsKey(PdfName.Producer)) { producer = info.getPdfObject().getAsString(PdfName.Producer).toUnicodeString(); } producer = addModifiedPostfix(producer); } info.getPdfObject().put(PdfName.Producer, new PdfString(producer)); }