Closed mikihiro-t closed 4 years ago
@mikihiro-t thanks for report! I'll check about this
Ok I have fixed in #8 1.1.3 will be available soon https://www.nuget.org/packages/kenjiuno.PdfSharp.Xps/1.1.3
Thank you for your help(1.1.3). I will try.
I have traced the code(1.1.2). This static Global has not disposed. When a xps file converted, Global.table.Count increses.
I'm not sure this code is good. But this works.
FontDescriptorStock.cs
public static void DisposeGlobal()
{
global = null;
}
XpsConverter.cs
At the last in Convert Method , call DisposeGlobal.
public static void Convert(string xpsFilename, string pdfFilename, int docIndex, bool createComparisonDocument)
PdfSharp.Fonts.FontDescriptorStock.DisposeGlobal();
Maybe this method(Stream) needs the same code.
public static void Convert(Stream xpsInStream, Stream pdfOutStream, bool closePdfStream)
Thank you very much. It was very helpful. Ver 1.1.3 works well.
Note: FontFamily.GetFamilies(graphics.gfx) turning off "Warning as error" https://forum.pdfsharp.net/viewtopic.php?f=2&t=903 So I can use the original code.
PdfSharp.Fonts.FontDescriptorStock.DisposeGlobal();
I'm not sure that keep using FontDescriptorStock.global
is good idea.
So, in 1.1.3 I have added FontDescriptorStock.NewInstance
and replaced all Global
references to NewInstance
not to rely on global cache mechanism.
I'm not sure about this too, however I have selected this since:
PdfSharp.Drawing\XFontFamily.cs I have changed this line(267) for Visual Studio 2017
Thanks, I have fixed it in https://github.com/HiraokaHyperTools/PDFsharp/pull/6
Current master
branch should provide merged code.
I'll close this issue due to long time inactivity. Please reopen or start new issue, if you still have problem...
Thank you for your kenjiuno.PdfSharp. I have made a solution with this.
Convert FlowDocument to XPS. And then Convert XPS to PDF files.
Problem is when many XPS Files to PDF files, this application crashes.
For Example,
Process Memory increases:
SnapShot of Memory: Memory sizes with PdfSharp.Fonts are increased.
test.xps is like this
Could you help me?
Note: PdfSharp.Drawing\XFontFamily.cs I have changed this line(267) for Visual Studio 2017 old
new