mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Simply order by offset also when not doing brute force to fix #1208
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -61,6 +61,9 @@ internal static partial class FirstPassParser
|
||||
}
|
||||
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)
|
||||
{
|
||||
@@ -81,6 +84,11 @@ internal static partial class FirstPassParser
|
||||
orderedXrefs.Add(obj);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
orderedXrefs.AddRange(
|
||||
streamsAndTables
|
||||
.OrderBy(x => x.Offset));
|
||||
}
|
||||
|
||||
DictionaryToken? lastTrailer = null;
|
||||
|
||||
Reference in New Issue
Block a user