mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 04:31:25 +08:00
parent
0754e7f003
commit
ba8e1e1b45
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
|
||||||
|
Binary file not shown.
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user