Skip to content

Commit

Permalink
Page resources were not inherited to xobjects if no Resources dict wa…
Browse files Browse the repository at this point in the history
…s specified on the xobject
  • Loading branch information
dmester committed Aug 17, 2024
1 parent de3163a commit d01a370
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/PdfToSvg/Drawing/SvgRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,11 @@ private void RenderXObject(PdfDictionary xobject, Action preparations)

try
{
resources = new ResourceCache(xobject.GetDictionaryOrEmpty(Names.Resources));
// In older PDF's the resources are specified on the page instead of the form.
if (xobject.TryGetDictionary(Names.Resources, out var resourcesDict))
{
resources = new ResourceCache(resourcesDict);
}

graphicsStateStack = new Stack<GraphicsState>();
graphicsState = graphicsState.Clone();
Expand Down
16 changes: 16 additions & 0 deletions tests/TestFiles/Own/expected/xobject-inherited-page-resources.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit d01a370

Please sign in to comment.