Skip to content

Commit 47bec78

Browse files
author
janne.möttölä
committed
Fix PdfOutline.SplitDestinationPage(PdfArray) to correctly handle PdfInteger members in the PdfArray argument
1 parent 2828a90 commit 47bec78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

PdfSharpCore/Pdf/PdfOutline.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ void SplitDestinationPage(PdfArray destination) // Reference: 8.2 Destination s
389389
#pragma warning disable 162
390390

391391
// The destination page may not yet transformed to PdfPage.
392-
PdfDictionary destPage = (PdfDictionary)((PdfReference)(destination.Elements[0])).Value;
392+
PdfDictionary destPage = (destination.Elements[0] is PdfInteger) ?
393+
destination.Owner.Pages[((PdfInteger)destination.Elements[0]).Value] :
394+
(PdfDictionary)((PdfReference)destination.Elements[0]).Value;
393395
PdfPage page = destPage as PdfPage;
394396
if (page == null)
395397
page = new PdfPage(destPage);

0 commit comments

Comments
 (0)