public bool GetString(int idx, out string result) { IntPtr res; if (CGPDFArrayGetString(handle, (IntPtr)idx, out res)) { result = CGPDFString.ToString(res); return(true); } result = null; return(false); }
public bool GetString(string key, out string result) { if (key == null) { throw new ArgumentNullException("key"); } IntPtr res; if (CGPDFDictionaryGetString(handle, key, out res)) { result = CGPDFString.ToString(res); return(true); } result = null; return(false); }
static object MapFromCGPdfObject(IntPtr pdfObj) { IntPtr ip; switch (CGPDFObjectGetType(pdfObj)) { case 1: // null return(null); case 2: // boolean byte b; if (CGPDFObjectGetValue(pdfObj, 2, out b)) { return(b != 0); } return(null); case 3: // int int i; if (CGPDFObjectGetValue(pdfObj, 3, out i)) { return(i); } return(null); case 4: // real float f; if (CGPDFObjectGetValue(pdfObj, 4, out f)) { return(f); } return(null); case 5: // name if (CGPDFObjectGetValue(pdfObj, 5, out ip)) { return(Marshal.PtrToStringAnsi(ip)); } return(null); case 6: // string if (CGPDFObjectGetValue(pdfObj, 6, out ip)) { return(CGPDFString.ToString(ip)); } return(null); case 7: // array if (CGPDFObjectGetValue(pdfObj, 7, out ip)) { return(new CGPDFArray(ip)); } return(null); case 8: // dictionary if (CGPDFObjectGetValue(pdfObj, 8, out ip)) { return(new CGPDFDictionary(ip)); } return(null); case 9: // stream if (CGPDFObjectGetValue(pdfObj, 9, out ip)) { return(new CGPDFStream(ip)); } return(null); } return(null); }