Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/UglyToad.PdfPig.Tests/Integration/GithubIssuesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,29 @@
using PdfPig.Core;
using PdfPig.Tokens;
using SkiaSharp;
using UglyToad.PdfPig.AcroForms;
using UglyToad.PdfPig.AcroForms.Fields;

public class GithubIssuesTests
{
[Fact]
public void Issue1208()
{
string[] files = ["Input.visible.pdf", "Input.invisible.pdf"];

foreach (var file in files)
{
var path = IntegrationHelpers.GetSpecificTestDocumentPath(file);

using (var document = PdfDocument.Open(path, new ParsingOptions() { UseLenientParsing = true }))
{
Assert.True(document.TryGetForm(out AcroForm form));
Assert.Single(form.Fields);
Assert.Equal(AcroFieldType.Signature, form.Fields[0].FieldType);
}
}
}

[Fact]
public void Revert_e11dc6b()
{
Expand Down
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions src/UglyToad.PdfPig/Parser/FileStructure/FirstPassParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public static FirstPassResults Parse(
}
else
{
/* Code below commented to fix issue #1208, while not failing test Issue874
* The logic would need to be reviewed before re-enabling.

// If we didn't brute force then use the previous position for ordering.
foreach (var obj in streamsAndTables)
{
Expand All @@ -81,6 +84,11 @@ public static FirstPassResults Parse(
orderedXrefs.Add(obj);
}
}
*/

orderedXrefs.AddRange(
streamsAndTables
.OrderBy(x => x.Offset));
}

DictionaryToken? lastTrailer = null;
Expand Down
Loading