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
Binary file not shown.
14 changes: 14 additions & 0 deletions src/UglyToad.PdfPig.Tests/Integration/GithubIssuesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@

public class GithubIssuesTests
{
[Fact]
public void Issues1238()
{
var path = IntegrationHelpers.GetDocumentPath("6.Secrets.to.Startup.Success.PDFDrive.pdf");

using (var document = PdfDocument.Open(path, new ParsingOptions() { UseLenientParsing = true }))
{
var page = document.GetPage(159);
Assert.NotNull(page);
Assert.StartsWith("uct. At the longer-cycle, broader end of the spectrum are identity-level", page.Text);
Assert.Equal(0, page.Rotation.Value);
}
}

[Fact]
public void Issue1217()
{
Expand Down
3 changes: 2 additions & 1 deletion src/UglyToad.PdfPig/Util/DictionaryTokenExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ public static PdfRectangle ToRectangle(this ArrayToken array, IPdfTokenScanner t
throw new ArgumentNullException(nameof(array));
}

if (array.Data.Count != 4)
if (array.Data.Count < 4)
{
// Should be exactly 4, but can be more (see issues 1238). We ignore the rest.
throw new PdfDocumentFormatException($"Cannot convert array to rectangle, expected 4 values instead got: {array.Data.Count}.");
}

Expand Down
Loading