0

I have a Windows service that is converting HTML to PDF. I am embedding a custom front by calling

var fontSwiftFont = pdfDoc.EmbedFont("swift-fontv2", LanguageType.Latin);

Everything works fine on my local pc and the QA environment, but after installing the new font on the production server, the font does not get embedded in the Pdf. The html displays fine in IE on the server though.

According to ABCPdf site, "Fonts are cached so newly added fonts will not be available to ABCpdf until the application is restarted.". However restarting the service does not fix the problem.

If I run a stand alone test app that does the same as the service it works.

I suspect rebooting will fix the issue, but I can't reboot because its a prod box running other apps.

AntonK
  • 2,303
  • 1
  • 20
  • 26
  • *If I run a stand alone test app that does the same as the service it works.* - that suggests permission issues. – mkl Feb 19 '16 at 12:00
  • 1
    Yes its running under a different account, which suggest that ABCPdf caches font on a per account basis, but still doesn't explain why a reboot is required to get the windows service to see to new font. – AntonK Feb 24 '16 at 04:50
  • That indeed is extreme. – mkl Feb 24 '16 at 05:42

3 Answers3

1

ABCpdf only knows about the current process. For it, restarting the process is exactly the same as rebooting the machine.

So if there is a difference between these two cases then the cause lies outside ABCpdf.

However the more mundane explanation would be that the wrong process is being restarted. The best way to check is to use Process Explorer (on MS site) to search your machine for all processes that have ABCpdf.dll loaded.

If you need ABCpdf to pick up on these fonts without a restart then you just need to call EmbedFont with a path to the font file. Similarly you can unload a font using the XFont.Unload function.

For details on these two functions see:

http://www.websupergoo.com/helppdfnet/source/5-abcpdf/doc/1-methods/embedfont.htm

http://www.websupergoo.com/helppdfnet/source/5-abcpdf/xfont/1-methods/unload.htm

Note that fonts for the Gecko HTML engine work slightly differently because the Gecko engine runs as a process pool. So even if ABCpdf knows about a new font, the sub-processes may not until they are restarted. This is something that can be forced using the EndTasks function.

For details of this function see:

http://www.websupergoo.com/helppdfnet/source/5-abcpdf/xhtmloptions/1-methods/endtasks.htm

0

Yes, the reboot fixed the problem. I am still puzzled as to where ABCPdf is storing the cached font and why it does not clear when I restart my windows service.

AntonK
  • 2,303
  • 1
  • 20
  • 26
  • Same situation, I need to reboot a server I think, did you found out why this was ? – Paul Dec 16 '16 at 07:51
0

I have the same issue, the font has been installed correctly and I can

AbcPdf can get this font if the request not via IIS. so I think the issue is this font only be install on my account, the IIS doesn't have it.

After I install for all users, the issue has been fix.