ElementBuilder.createTextRun problem with some characters, PDFNet.js

Hello. When creating text run like this:

let currentFont: pdftron.PDFNet.Font = await Font.create(pdfDoc, Font.StandardType1Font.e_times_roman);
element = await eb.createTextRun(value, currentFont, currentFontSize);

and trying to write a “—” (em dash) character as the value, am seeing — on screen.
Have couple of questions regarding this:

  1. Are there any other options rather than using StandardType1Font fonts in Web API. Unicode fonts for example?
  2. what format does the createTextRunUnsigned function expect for the text_data? Whatever I pass. am getting following error in the console:
    Uncaught (in promise) abort(16). Build with -s ASSERTIONS=1 for more info.
  3. any approaches to solve the problem? My guess is it won’t be just limited to the “em dash” character.


Thank you for contacting us about this. You will need to use the createUnicodeTextRun method instead of createTextRun to write unicode values.

Cor some code examples, please refer to the following sample code.

Thanks for reply.
Unfortunately, there is no createUnicodeTextRun method available in Web SDK.
Also can you please answer my other question?

It looks like createUnicodeTextRun was just added to our main PDFTron SDK in the latest release so this API will be integrated into the Web SDK in its next release which is planned for June.

createUnicodeTextRun will be available in tomorrow’s (May 27) nightly experimental build. Here are instructions on how to test it out https://www.pdftron.com/documentation/web/faq/webviewer-nightly-build/

checking in 7.3.2-20210531 and that function is missing on element builder