Default page number to 0 in ExplicitDestination when the Dest has no page number and fix #736
Some checks failed
Build and test / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / Check latest commit (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled

This commit is contained in:
BobLd 2024-10-25 21:18:16 +01:00
parent e10609e4e1
commit 40af401364
4 changed files with 17 additions and 2 deletions

View File

@ -4,6 +4,19 @@
public class GithubIssuesTests
{
[Fact]
public void Issue736()
{
var doc = IntegrationHelpers.GetDocumentPath("Approved_Document_B__fire_safety__volume_2_-_Buildings_other_than_dwellings__2019_edition_incorporating_2020_and_2022_amendments.pdf");
using (var document = PdfDocument.Open(doc, new ParsingOptions() { UseLenientParsing = true, SkipMissingFonts = true }))
{
Assert.True(document.TryGetBookmarks(out var bookmarks));
Assert.Single(bookmarks.Roots);
Assert.Equal(36, bookmarks.Roots[0].Children.Count);
}
}
[Fact]
public void Issue693()
{

View File

@ -7,6 +7,7 @@
{
/// <summary>
/// The page number (1-based) of the destination.
/// <para>A value of <c>0</c> means no page destination was available (i.e. an invalid explicit destination).</para>
/// </summary>
public int PageNumber { get; }

View File

@ -136,11 +136,11 @@
}
else
{
var errorMessage = $"{nameof(TryGetExplicitDestination)} No page number given in 'Dest': '{explicitDestinationArray}'.";
var errorMessage = $"{nameof(TryGetExplicitDestination)} No page number given in 'Dest': '{explicitDestinationArray}', defaulting to 0.";
log?.Error(errorMessage);
return false;
pageNumber = 0;
}
NameToken? destTypeToken = null;
@ -148,6 +148,7 @@
{
destTypeToken = explicitDestinationArray[1] as NameToken;
}
if (destTypeToken is null)
{
var errorMessage = $"Missing name token as second argument to explicit destination: {explicitDestinationArray}.";