diff --git a/PdfSharpCore/Pdf/PdfOutline.cs b/PdfSharpCore/Pdf/PdfOutline.cs index 34b75b26..39f5b5f9 100644 --- a/PdfSharpCore/Pdf/PdfOutline.cs +++ b/PdfSharpCore/Pdf/PdfOutline.cs @@ -389,7 +389,9 @@ void SplitDestinationPage(PdfArray destination) // Reference: 8.2 Destination s #pragma warning disable 162 // The destination page may not yet transformed to PdfPage. - PdfDictionary destPage = (PdfDictionary)((PdfReference)(destination.Elements[0])).Value; + PdfDictionary destPage = (destination.Elements[0] is PdfInteger) ? + destination.Owner.Pages[((PdfInteger)destination.Elements[0]).Value] : + (PdfDictionary)((PdfReference)destination.Elements[0]).Value; PdfPage page = destPage as PdfPage; if (page == null) page = new PdfPage(destPage);