fix test name
This commit is contained in:
Matěj Štágl 2025-03-26 00:46:42 +01:00 committed by BobLd
parent 0754e7f003
commit ba8e1e1b45
4 changed files with 27 additions and 5 deletions

1
.gitignore vendored
View File

@ -105,6 +105,7 @@ $tf/
_ReSharper*/ _ReSharper*/
*.[Rr]e[Ss]harper *.[Rr]e[Ss]harper
*.DotSettings.user *.DotSettings.user
.idea
# JustCode is a .NET coding add-in # JustCode is a .NET coding add-in
.JustCode .JustCode

View File

@ -780,6 +780,24 @@
} }
} }
[Fact]
public void CanCopyIssue1017()
{
using (var document = PdfDocument.Open(IntegrationHelpers.GetDocumentPath("_citUR2jB1_ay56u6vELzk.pdf")))
{
using (var pdfWriter = new PdfDocumentBuilder())
{
var page = document.GetPage(1);
var newPage = pdfWriter.AddPage(page.Width, page.Height);
newPage.CopyFrom(page);
var b = pdfWriter.Build();
Assert.NotEmpty(b);
}
}
}
[Fact] [Fact]
public void CanCopyPage() public void CanCopyPage()
{ {

View File

@ -974,13 +974,16 @@
gstateName = newName; gstateName = newName;
} }
if (!(gstate.Value is IndirectReferenceToken fontReferenceToken)) // According to PDF spec 32000-1:2008, section 8.4.5, ExtGState can contain both direct values and indirect references
if (gstate.Value is IndirectReferenceToken fontReferenceToken)
{ {
throw new PdfDocumentFormatException($"Expected a IndirectReferenceToken for the XObject, got a {gstate.Value.GetType().Name}"); pageGstateDictionary[gstateName] = documentBuilder.CopyToken(srcPage.pdfScanner, fontReferenceToken);
}
else
{
pageGstateDictionary[gstateName] = documentBuilder.CopyToken(srcPage.pdfScanner, gstate.Value);
} }
pageGstateDictionary[gstateName] = documentBuilder.CopyToken(srcPage.pdfScanner, fontReferenceToken);
} }
} }