/** * Returns a <CODE>PdfObject</CODE> as a <CODE>PdfString</CODE>, * resolving indirect references. * * The object corresponding to the specified index is retrieved and * resolved to a direct object. * If it is a <CODE>PdfString</CODE>, it is cast down and returned as such. * Otherwise <CODE>null</CODE> is returned. * * @param idx The index of the <CODE>PdfObject</CODE> to be returned * @return the corresponding <CODE>PdfString</CODE> object, * or <CODE>null</CODE> */ public PdfString getAsString(final int idx) { PdfString string = null; PdfObject orig = getDirectObject(idx); if (orig != null && orig.isString()) string = (PdfString) orig; return string; }
/** * Returns a <CODE>PdfObject</CODE> as a <CODE>PdfString</CODE>, * resolving indirect references. * * The object associated with the <CODE>PdfName</CODE> given is retrieved * and resolved to a direct object. * If it is a <CODE>PdfString</CODE>, it is cast down and returned as such. * Otherwise <CODE>null</CODE> is returned. * * @param key A <CODE>PdfName</CODE> * @return the associated <CODE>PdfString</CODE> object, * or <CODE>null</CODE> */ public PdfString getAsString(final PdfName key) { PdfString string = null; PdfObject orig = getDirectObject(key); if (orig != null && orig.isString()) string = (PdfString) orig; return string; }
/** * Returns a <CODE>PdfObject</CODE> as a <CODE>PdfString</CODE>, * resolving indirect references. * * The object corresponding to the specified index is retrieved and * resolved to a direct object. * If it is a <CODE>PdfString</CODE>, it is cast down and returned as such. * Otherwise <CODE>null</CODE> is returned. * * @param idx The index of the <CODE>PdfObject</CODE> to be returned * @return the corresponding <CODE>PdfString</CODE> object, * or <CODE>null</CODE> */ public PdfString getAsString(final int idx) { PdfString string = null; PdfObject orig = getDirectObject(idx); if (orig != null && orig.isString()) string = (PdfString) orig; return string; }
/** * Returns a <CODE>PdfObject</CODE> as a <CODE>PdfString</CODE>, * resolving indirect references. * * The object associated with the <CODE>PdfName</CODE> given is retrieved * and resolved to a direct object. * If it is a <CODE>PdfString</CODE>, it is cast down and returned as such. * Otherwise <CODE>null</CODE> is returned. * * @param key A <CODE>PdfName</CODE> * @return the associated <CODE>PdfString</CODE> object, * or <CODE>null</CODE> */ public PdfString getAsString(final PdfName key) { PdfString string = null; PdfObject orig = getDirectObject(key); if (orig != null && orig.isString()) string = (PdfString) orig; return string; }
return null; else { if (((PdfObject)obj).isString()) return ((PdfString)obj).toUnicodeString(); else
return null; else { if (((PdfObject)obj).isString()) return ((PdfString)obj).toUnicodeString(); else
private static void mapGotoBookmark(HashMap<String, Object> map, PdfObject dest, IntHashtable pages) { if (dest.isString()) map.put("Named", dest.toString()); else if (dest.isName()) map.put("Named", PdfName.decodeName(dest.toString())); else if (dest.isArray()) map.put("Page", makeBookmarkParam((PdfArray)dest, pages)); //changed by ujihara 2004-06-13 map.put("Action", "GoTo"); }
private static void mapGotoBookmark(HashMap<String, Object> map, PdfObject dest, IntHashtable pages) { if (dest.isString()) map.put("Named", dest.toString()); else if (dest.isName()) map.put("Named", PdfName.decodeName(dest.toString())); else if (dest.isArray()) map.put("Page", makeBookmarkParam((PdfArray)dest, pages)); //changed by ujihara 2004-06-13 map.put("Action", "GoTo"); }
protected static String getNameString(final PdfDictionary dic, final PdfName key) { PdfObject obj = PdfReader.getPdfObject(dic.get(key)); if (obj == null || !obj.isString()) return null; return ((PdfString)obj).toUnicodeString(); }
protected static String getNameString(final PdfDictionary dic, final PdfName key) { PdfObject obj = PdfReader.getPdfObject(dic.get(key)); if (obj == null || !obj.isString()) return null; return ((PdfString)obj).toUnicodeString(); }
PdfObject obj = getPdfObjectRelease(j.get(PdfName.JS)); if (obj != null) { if (obj.isString()) buf.append(((PdfString)obj).toUnicodeString()).append('\n'); else if (obj.isStream()) {
/** * @param os * @param info * @throws IOException */ public XmpWriter(OutputStream os, PdfDictionary info) throws IOException { this(os); if (info != null) { PdfName key; PdfObject obj; String value; for (PdfName pdfName : info.getKeys()) { key = pdfName; obj = info.get(key); if (obj == null) continue; if (!obj.isString()) continue; value = ((PdfString) obj).toUnicodeString(); try { addDocInfoProperty(key, value); } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } } } }
/** * @param os * @param info * @throws IOException */ public XmpWriter(OutputStream os, PdfDictionary info) throws IOException { this(os); if (info != null) { PdfName key; PdfObject obj; String value; for (PdfName pdfName : info.getKeys()) { key = pdfName; obj = info.get(key); if (obj == null) continue; if (!obj.isString()) continue; value = ((PdfString) obj).toUnicodeString(); try { addDocInfoProperty(key, value); } catch (XMPException xmpExc) { throw new IOException(xmpExc.getMessage()); } } } }
if (v.isName()) return PdfName.decodeName(((PdfName)v).toString()); else if (v.isString()) { PdfString vs = (PdfString)v; if (encoding == null || vs.getEncoding() != null)
if (v.isName()) return PdfName.decodeName(((PdfName)v).toString()); else if (v.isString()) { PdfString vs = (PdfString)v; if (encoding == null || vs.getEncoding() != null)
serArray((PdfArray)obj, level - 1, bb, serialized); else if (obj.isString()) { bb.append("$S").append(obj.toString());
private String[] getListOption(String fieldName, int idx) { Item fd = getFieldItem(fieldName); if (fd == null) return null; PdfArray ar = fd.getMerged(0).getAsArray(PdfName.OPT); if (ar == null) return null; String[] ret = new String[ar.size()]; for (int k = 0; k < ar.size(); ++k) { PdfObject obj = ar.getDirectObject( k ); try { if (obj.isArray()) { obj = ((PdfArray)obj).getDirectObject(idx); } if (obj.isString()) ret[k] = ((PdfString)obj).toUnicodeString(); else ret[k] = obj.toString(); } catch (Exception e) { ret[k] = ""; } } return ret; }
private String[] getListOption(String fieldName, int idx) { Item fd = getFieldItem(fieldName); if (fd == null) return null; PdfArray ar = fd.getMerged(0).getAsArray(PdfName.OPT); if (ar == null) return null; String[] ret = new String[ar.size()]; for (int k = 0; k < ar.size(); ++k) { PdfObject obj = ar.getDirectObject( k ); try { if (obj.isArray()) { obj = ((PdfArray)obj).getDirectObject(idx); } if (obj.isString()) ret[k] = ((PdfString)obj).toUnicodeString(); else ret[k] = obj.toString(); } catch (Exception e) { ret[k] = ""; } } return ret; }
if (sub.isEmpty()) return; obj = sub.getPdfObject(0); if (obj.isString()) { layer = new PdfLayer(obj.toString()); layer.setOnPanel(true);
if (ob3.isName()) name = ob3; else if (ob3.isString()) name = ob3.toString(); PdfArray dest = (PdfArray)names.get(name);