PDFDoc.RefreshFieldAppearances hangs when foreign characters are used

Product: PDFTron.NetFramework.x64

Product Version: 9.1.0.78584

Please give a brief summary of your issue:
When foreign characters are used in field values, RefreshFieldAppearances hangs (doesn’t return or throw an exception)

Please describe your issue and provide steps to reproduce it:

  1. Using a fillable PDF, set value of a field to something including some foreign characters such as “中国äč”
  2. Then call doc.RefreshFieldAppearances()
  3. There are two outcomes, on my Windows machine this completes as you would expect with the characters properly appearing in the field. When the same application is deployed into an Azure Web App, it never returns and does not throw an exception, it just hangs there.

I’m assuming it has to do with the installed fonts on the host, but it is unclear how to work around this issue with the PDFTron library.

Please provide a link to a minimal sample where the issue is reproducible:

Hello Jeremy,

Welcome to the community!

Since the code is working locally, and the issue is Azure specific, its possible your instance is lacking fonts with enough coverage for conversion. The following will help your server have minimal Unicode coverage.

  1. Download the web fonts package from here: http://pdftron.s3.amazonaws.com/downloads/SelfServeWebFontsV2.zip
  2. Extract the zip somewhere that the code can access (make sure the permissions are correct)
  3. Add the following line of code after PDFNet.Initialize().

    PDFNet.addResourceSearchPath(path_to_fonts_above);

Please note that due to some sandboxing Windows does, our .NET framework SDK is not compatible with all Azure options. While probably unrelated to this particular issue, you may want to switch to our .NET Core SDK. See the last Changed Behavior entry here.

Finally, GDI+ may be missing/blocked by your OS: https://www.pdftron.com/documentation/windows/faq/dotnet-fileload-exception/#unable-to-load-dll-pdfnetdll-or-one-of-its-dependencies:-a-dynamic-link-library-dll-initialization-routine-failed-0x8007045a

1 Like