diff --git a/src/PdfSharp/Pdf/PdfDictionary.cs b/src/PdfSharp/Pdf/PdfDictionary.cs index 428140a1..aed19775 100644 --- a/src/PdfSharp/Pdf/PdfDictionary.cs +++ b/src/PdfSharp/Pdf/PdfDictionary.cs @@ -407,7 +407,10 @@ public int GetInteger(string key, bool create) if (integerObject != null) return integerObject.Value; - throw new InvalidCastException("GetInteger: Object is not an integer."); + PdfUInteger uinteger = obj as PdfUInteger; + if (uinteger != null) + return (int)uinteger.Value; + throw new InvalidCastException("GetInteger: Object is not an integer."); } ///