mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
@@ -838,71 +838,80 @@ namespace UglyToad.PdfPig.Writer
|
|||||||
}
|
}
|
||||||
|
|
||||||
return childObjectNumbers;
|
return childObjectNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
static ArrayToken CreateExplicitDestinationToken(ExplicitDestination destination, IndirectReferenceToken page)
|
private static ArrayToken CreateExplicitDestinationToken(ExplicitDestination destination, IndirectReferenceToken page)
|
||||||
{
|
{
|
||||||
return destination.Type switch
|
switch (destination.Type)
|
||||||
{
|
{
|
||||||
ExplicitDestinationType.XyzCoordinates => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.XyzCoordinates:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.XYZ,
|
NameToken.XYZ,
|
||||||
new NumericToken(destination.Coordinates.Left ?? 0),
|
new NumericToken(destination.Coordinates.Left ?? 0),
|
||||||
new NumericToken(destination.Coordinates.Top ?? 0),
|
new NumericToken(destination.Coordinates.Top ?? 0)
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitPage => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitPage:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.Fit,
|
NameToken.Fit
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitHorizontally => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitHorizontally:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.FitH,
|
NameToken.FitH,
|
||||||
new NumericToken(destination.Coordinates.Top ?? 0),
|
new NumericToken(destination.Coordinates.Top ?? 0)
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitVertically => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitVertically:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.FitV,
|
NameToken.FitV,
|
||||||
new NumericToken(destination.Coordinates.Left ?? 0),
|
new NumericToken(destination.Coordinates.Left ?? 0)
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitRectangle => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitRectangle:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.FitR,
|
NameToken.FitR,
|
||||||
new NumericToken(destination.Coordinates.Left ?? 0),
|
new NumericToken(destination.Coordinates.Left ?? 0),
|
||||||
new NumericToken(destination.Coordinates.Top ?? 0),
|
new NumericToken(destination.Coordinates.Top ?? 0),
|
||||||
new NumericToken(destination.Coordinates.Right ?? 0),
|
new NumericToken(destination.Coordinates.Right ?? 0),
|
||||||
new NumericToken(destination.Coordinates.Bottom ?? 0),
|
new NumericToken(destination.Coordinates.Bottom ?? 0)
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitBoundingBox => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitBoundingBox:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.FitB,
|
NameToken.FitB,
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitBoundingBoxHorizontally => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitBoundingBoxHorizontally:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.FitBH,
|
NameToken.FitBH,
|
||||||
new NumericToken(destination.Coordinates.Left ?? 0),
|
new NumericToken(destination.Coordinates.Left ?? 0)
|
||||||
}),
|
});
|
||||||
|
|
||||||
ExplicitDestinationType.FitBoundingBoxVertically => new ArrayToken(new IToken[]
|
case ExplicitDestinationType.FitBoundingBoxVertically:
|
||||||
|
return new ArrayToken(new IToken[]
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
NameToken.FitBV,
|
NameToken.FitBV,
|
||||||
new NumericToken(destination.Coordinates.Left ?? 0),
|
new NumericToken(destination.Coordinates.Left ?? 0)
|
||||||
}),
|
});
|
||||||
|
|
||||||
_ => throw new NotSupportedException($"{destination.Type} is not a supported bookmark destination type."),
|
default:
|
||||||
};
|
throw new NotSupportedException($"{destination.Type} is not a supported bookmark destination type.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user