@Override public String getRole() { return currRole.getValue(); }
public String getRole() { return currRole.getValue(); }
/** * Compare this PdfName to o. * * @param o PdfName to compare this object to/ * @return Comparison between both values or, if one of the values is null, Comparison between contents. If one of the values and one of the contents are equal to null, generate values and compare those. */ @Override public int compareTo(PdfName o) { return getValue().compareTo(o.getValue()); }
@Override public String toString() { if (content != null) return "/" + new String(content); else return "/" + getValue(); }
@Override public int hashCode() { return getValue().hashCode(); }
@Override public boolean currentRoleIsStandard() { return StandardNamespaces.roleBelongsToStandardNamespace(currRole.getValue(), StandardNamespaces.PDF_1_7); }
public static String generateFileDisplay(PdfEncryptedPayload ep) { return ep.getSubtype().getValue() + "Protected.pdf"; }
@Override public PdfObject getDestinationPage(Map<String, PdfObject> names) { PdfArray array = (PdfArray) names.get(((PdfName)getPdfObject()).getValue()); return array != null ? array.get(0) : null; }
/** * Gets current tag role. * * @return current tag role. */ public String getRole() { return getCurrentStructElem().getRole().getValue(); }
@Override public String getPhoneticAlphabet() { return getBackingElem().getPhoneticAlphabet().getValue(); }
@Override public String getRole() { return getBackingElem().getRole().getValue(); }
public boolean currentRoleIsStandard() { String roleStrVal = currRole.getValue(); boolean stdRole17 = currNamespace.getNamespaceName().equals(StandardNamespaces.PDF_1_7) && StandardNamespaces.roleBelongsToStandardNamespace(roleStrVal, StandardNamespaces.PDF_1_7); boolean stdRole20 = currNamespace.getNamespaceName().equals(StandardNamespaces.PDF_2_0) && StandardNamespaces.roleBelongsToStandardNamespace(roleStrVal, StandardNamespaces.PDF_2_0); return stdRole17 || stdRole20; }
private static CMapEncoding createCMap(PdfObject cmap, String uniMap) { if (cmap.isStream()) { PdfStream cmapStream = (PdfStream) cmap; byte[] cmapBytes = cmapStream.getBytes(); return new CMapEncoding(cmapStream.getAsName(PdfName.CMapName).getValue(), cmapBytes); } else { String cmapName = ((PdfName) cmap).getValue(); if (PdfEncodings.IDENTITY_H.equals(cmapName) || PdfEncodings.IDENTITY_V.equals(cmapName)) { return new CMapEncoding(cmapName); } else { return new CMapEncoding(cmapName, uniMap); } } }
public String getAttributeAsEnum(String attributeName) { PdfName name = PdfStructTreeRoot.convertRoleToPdfName(attributeName); PdfName attrVal = getPdfObject().getAsName(name); return attrVal != null ? attrVal.getValue() : null; }
public PdfObject getValue(String value) { switch (subType) { case TEXT: return new PdfString(value); case DATE: return new PdfDate(PdfDate.decode(value)).getPdfObject(); case NUMBER: return new PdfNumber(Double.parseDouble(value.trim())); } throw new PdfException(PdfException._1IsNotAnAcceptableValueForTheField2).setMessageParams(value, getPdfObject().getAsName(PdfName.N).getValue()); }
private DocTrueTypeFont(PdfDictionary fontDictionary) { super(); PdfName baseFontName = fontDictionary.getAsName(PdfName.BaseFont); if (baseFontName != null) { setFontName(baseFontName.getValue()); } else { setFontName(FontUtil.createRandomFontName()); } subtype = fontDictionary.getAsName(PdfName.Subtype); }
/** * 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 wrapAllKidsInTag(PdfStructElem parent, PdfName wrapTagRole, PdfNamespace wrapTagNs) { int kidsNum = parent.getKids().size(); TagTreePointer tagPointer = new TagTreePointer(parent, document); tagPointer.addTag(0, wrapTagRole.getValue()); if (context.targetTagStructureVersionIs2()) { tagPointer.getProperties().setNamespace(wrapTagNs); } TagTreePointer newParentOfKids = new TagTreePointer(tagPointer); tagPointer.moveToParent(); for (int i = 0; i < kidsNum; ++i) { tagPointer.relocateKid(1, newParentOfKids); } }