I'm using the iText 7 .NET dll and I want to know what's the difference between the PdfFontFactory.RegisterSystemDirectories()
methods and the following ones:
PdfFontFactory.CreateRegisteredFont("calibri", PdfEncodings.IDENTITY_H, True)
PdfFontFactory.RegisterDirectory("C:\Windows\Fonts\Calibri")
FontProgramFactory.RegisterFontDirectory("C:\Windows\Fonts\Calibri")
FontProgramFactory.CreateRegisteredFont("calibri")
Because when I ask for PdfFontFactory.GetRegisteredFonts()
, the result is only impacted by the first one, not by the others.
I've sometimes an OutOfMemoryException
and I saw that the RegisterSystemDirectories
increase the memory by 500 mb whereas I only need of 12 family fonts ("arial", "calibri", "comic", "georgia", "lucida", "segoe", "times", "trebuchet", "verdana", "consola"). If I don't register them, when I add a paragraph with one of these fonts to my PdfDocument, an exception occured: "Invalid font type".
So I search a solution to register only these families.
Thank you very much.
I don't have/find any answer about my question yet, but I found another method which does what I want : PdfFontFactory.Register("C:\Windows\Fonts\CALIBRI.TTF")
. I should to do that for each font I want to use, but it saves until 400 mb of memory!