1
- #region PDFsharp - A .NET library for processing PDF
1
+ #region PDFsharp - A .NET library for processing PDF
2
2
//
3
3
// Authors:
4
4
// Stefan Lange
@@ -354,11 +354,9 @@ void Initialize()
354
354
PdfItem a = Elements . GetValue ( Keys . A ) ;
355
355
Debug . Assert ( dest == null || a == null , "Either destination or goto action." ) ;
356
356
357
- PdfArray destArray = null ;
358
357
if ( dest != null )
359
358
{
360
- destArray = dest as PdfArray ;
361
- if ( destArray != null )
359
+ if ( dest is PdfArray destArray )
362
360
{
363
361
SplitDestinationPage ( destArray ) ;
364
362
}
@@ -374,14 +372,20 @@ void Initialize()
374
372
if ( action != null && action . Elements . GetName ( PdfAction . Keys . S ) == "/GoTo" )
375
373
{
376
374
dest = action . Elements [ PdfGoToAction . Keys . D ] ;
377
- destArray = dest as PdfArray ;
378
- if ( destArray != null )
375
+ if ( dest is PdfArray destArray )
379
376
{
380
377
// Replace Action with /Dest entry.
381
378
Elements . Remove ( Keys . A ) ;
382
379
Elements . Add ( Keys . Dest , destArray ) ;
383
380
SplitDestinationPage ( destArray ) ;
384
381
}
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
+ }
385
389
else
386
390
{
387
391
throw new Exception ( "Destination Array expected." ) ;
@@ -732,14 +736,14 @@ internal sealed class Keys : KeysBase
732
736
733
737
/// <summary>
734
738
/// (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.
736
740
/// </summary>
737
741
[ KeyInfo ( KeyType . Dictionary | KeyType . Required ) ]
738
742
public const string First = "/First" ;
739
743
740
744
/// <summary>
741
745
/// (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.
743
747
/// </summary>
744
748
[ KeyInfo ( KeyType . Dictionary | KeyType . Required ) ]
745
749
public const string Last = "/Last" ;
@@ -780,15 +784,15 @@ internal sealed class Keys : KeysBase
780
784
781
785
/// <summary>
782
786
/// (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.
784
788
/// Default value: [0.0 0.0 0.0].
785
789
/// </summary>
786
790
[ KeyInfo ( KeyType . Array | KeyType . Optional ) ]
787
791
public const string C = "/C" ;
788
792
789
793
/// <summary>
790
794
/// (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.
792
796
/// </summary>
793
797
[ KeyInfo ( KeyType . Integer | KeyType . Optional ) ]
794
798
public const string F = "/F" ;
0 commit comments