I’m noticed that while adding the svg graphics to pdf document all the fonts that are being used in the graphic are copied to the appropriate temp folder. The issue is that handles to those font files aren’t released after document is saved and disposed, rather the process keeps their handle for its whole lifetime. While generating next documents, copies of the same font files are being added to the temp folder, until some threshold is reached and it is impossible to add graphics to the document, since exception is being thrown.
Here is a sample project:
svg-in-pdf-app.zip (3.0 KB)
Please see the attached console application that hopefully can demonstrate the problem. Try generating relatively large number of dummy pdf files (e.g. 300) and see that:
- After first iteration “TempFontsGraphics” folder with all used font is being created in Temp directory.
temp-graphics-folder.png (10.0 KB) - Each subsequent iteration will create copies of fonts directly in the Temp folder.
temp-fonts.png (53.3 KB) - As soon as 255th copy is about to be created – application crashes.
console-error.png (30.9 KB)
Side notes:
• IOutputStorage implementation is take from samples (Save an SVG Document - C#).
• Disposables class is added just to make sure that all relevant dispose calls are made explicitly.