[pdfmod] [PdfSharp] Re-apply InvalidCastException and RegionInfo fixes



commit 9a3b3d697feb5069cc6df82a31d4c290d0985ff7
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Fri Aug 27 12:25:56 2010 -0500

    [PdfSharp] Re-apply InvalidCastException and RegionInfo fixes

 lib/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs |    4 ++--
 lib/PdfSharp/PdfSharp.Pdf/PdfPage.cs       |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/lib/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs b/lib/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs
index 77256dd..a781c31 100644
--- a/lib/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs
+++ b/lib/PdfSharp/PdfSharp.Pdf/PdfDictionary.cs
@@ -678,7 +678,7 @@ namespace PdfSharp.Pdf
         if (obj is PdfString)
           date = ((PdfString)obj).Value;
         else if (obj is PdfStringObject)
-          date = ((PdfNameObject)obj).Value;
+          date = ((PdfStringObject)obj).Value;
         else
           throw new InvalidCastException("GetName: Object is not a name.");
 
@@ -1605,4 +1605,4 @@ namespace PdfSharp.Pdf
       }
     }
   }
-}
\ No newline at end of file
+}
diff --git a/lib/PdfSharp/PdfSharp.Pdf/PdfPage.cs b/lib/PdfSharp/PdfSharp.Pdf/PdfPage.cs
index 8a114ba..4eeb219 100644
--- a/lib/PdfSharp/PdfSharp.Pdf/PdfPage.cs
+++ b/lib/PdfSharp/PdfSharp.Pdf/PdfPage.cs
@@ -79,7 +79,7 @@ namespace PdfSharp.Pdf
 
     void Initialize()
     {
-      Size = RegionInfo.CurrentRegion.IsMetric ? PageSize.A4 : PageSize.Letter;
+      Size = RegionInfo.CurrentRegion != null && RegionInfo.CurrentRegion.IsMetric ? PageSize.A4 : PageSize.Letter;
 
 #pragma warning disable 168
       // Force creation of MediaBox object by invoking property



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]