0
votes

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.

2
If I run a stand alone test app that does the same as the service it works. - that suggests permission issues. - mkl
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
That indeed is extreme. - mkl

2 Answers

1
votes

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
votes

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.