/ Published in: C#
Provide the PDF document content as a string and it will return the data content of properties like Title or Subject.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private static string GetPropertyValueEx(string pdfData, string propertyName) { var result = ""; var propertyNameLength = propertyName.Length + 3; var leadLength = 4; var m = r2.Match(pdfData); if (m.Success) { //System.Diagnostics.Debug.WriteLine(m.Index); var valueRaw = m.Value.Substring(propertyNameLength, m.Value.Length - propertyNameLength - 1); for (int i = leadLength; i < valueRaw.Length; i = i + 4) { var hexVal = valueRaw.Substring(i, 4); var num = (Convert.ToUInt32(hexVal, 16)); result += (char)num; } } return result; }