1- #region PDFsharp - A .NET library for processing PDF
1+ #region PDFsharp - A .NET library for processing PDF
22//
33// Authors:
44// Stefan Lange
@@ -354,11 +354,9 @@ void Initialize()
354354 PdfItem a = Elements . GetValue ( Keys . A ) ;
355355 Debug . Assert ( dest == null || a == null , "Either destination or goto action." ) ;
356356
357- PdfArray destArray = null ;
358357 if ( dest != null )
359358 {
360- destArray = dest as PdfArray ;
361- if ( destArray != null )
359+ if ( dest is PdfArray destArray )
362360 {
363361 SplitDestinationPage ( destArray ) ;
364362 }
@@ -374,14 +372,20 @@ void Initialize()
374372 if ( action != null && action . Elements . GetName ( PdfAction . Keys . S ) == "/GoTo" )
375373 {
376374 dest = action . Elements [ PdfGoToAction . Keys . D ] ;
377- destArray = dest as PdfArray ;
378- if ( destArray != null )
375+ if ( dest is PdfArray destArray )
379376 {
380377 // Replace Action with /Dest entry.
381378 Elements . Remove ( Keys . A ) ;
382379 Elements . Add ( Keys . Dest , destArray ) ;
383380 SplitDestinationPage ( destArray ) ;
384381 }
382+ else if ( dest is PdfReference detRef )
383+ {
384+ // Replace Action with /Dest entry.
385+ Elements . Remove ( Keys . A ) ;
386+ Elements . Add ( Keys . Dest , detRef . Value ) ;
387+ SplitDestinationPage ( ( PdfArray ) detRef . Value ) ;
388+ }
385389 else
386390 {
387391 throw new Exception ( "Destination Array expected." ) ;
@@ -732,14 +736,14 @@ internal sealed class Keys : KeysBase
732736
733737 /// <summary>
734738 /// (Required if the item has any descendants; must be an indirect reference)
735- /// The first of this item s immediate children in the outline hierarchy.
739+ /// The first of this item’ s immediate children in the outline hierarchy.
736740 /// </summary>
737741 [ KeyInfo ( KeyType . Dictionary | KeyType . Required ) ]
738742 public const string First = "/First" ;
739743
740744 /// <summary>
741745 /// (Required if the item has any descendants; must be an indirect reference)
742- /// The last of this item s immediate children in the outline hierarchy.
746+ /// The last of this item’ s immediate children in the outline hierarchy.
743747 /// </summary>
744748 [ KeyInfo ( KeyType . Dictionary | KeyType . Required ) ]
745749 public const string Last = "/Last" ;
@@ -780,15 +784,15 @@ internal sealed class Keys : KeysBase
780784
781785 /// <summary>
782786 /// (Optional; PDF 1.4) An array of three numbers in the range 0.0 to 1.0, representing the
783- /// components in the DeviceRGB color space of the color to be used for the outline entry s text.
787+ /// components in the DeviceRGB color space of the color to be used for the outline entry’ s text.
784788 /// Default value: [0.0 0.0 0.0].
785789 /// </summary>
786790 [ KeyInfo ( KeyType . Array | KeyType . Optional ) ]
787791 public const string C = "/C" ;
788792
789793 /// <summary>
790794 /// (Optional; PDF 1.4) A set of flags specifying style characteristics for displaying the outline
791- /// item s text. Default value: 0.
795+ /// item’ s text. Default value: 0.
792796 /// </summary>
793797 [ KeyInfo ( KeyType . Integer | KeyType . Optional ) ]
794798 public const string F = "/F" ;
0 commit comments