#82 make resource store state local to the page and operation being processed

resources such as fonts are linked to page content operations using name labels, e.g. "/F1", these resource labels can be reassigned on different pages or inside form xobjects. we now clear the entire resource state for each page which is parsed and after form xobject operations which use resource dictionaries.
This commit is contained in:
Eliot Jones
2019-11-25 14:34:02 +00:00
parent 9028f932b2
commit 677d2b5e8f
8 changed files with 121 additions and 20 deletions

View File

@@ -336,7 +336,8 @@
* 5. Restore the saved graphics state, as if by invoking the Q operator.
*/
if (formStream.StreamDictionary.TryGet<DictionaryToken>(NameToken.Resources, pdfScanner, out var formResources))
var hasResources = formStream.StreamDictionary.TryGet<DictionaryToken>(NameToken.Resources, pdfScanner, out var formResources);
if (hasResources)
{
resourceStore.LoadResourceDictionary(formResources, isLenientParsing);
}
@@ -368,6 +369,11 @@
// 5. Restore saved state.
PopState();
if (hasResources)
{
resourceStore.UnloadResourceDictionary();
}
}
public void BeginSubpath()