xceedsoftware / DocX

Fast and easy to use .NET library that creates or modifies Microsoft Word files without installing Word.
Other
1.77k stars 472 forks source link

Index outside bounds of the array when converting to PDF #398

Open luke-browning opened 3 years ago

luke-browning commented 3 years ago

I am trying to evaluate Words for .NET but am not getting any response from your support email address so I thought I'd try here.

I have a word doc: Simplified Chinese.docx. When I try to convert this file to PDF I get "Index was outside the bounds of the array.". (The extra font used is available here: https://github.com/jsntn/webfonts/blob/master/NotoSansSC-Regular.ttf)

My code for the conversion is as follows;

DocX.ConvertToPdf(doc, saveStream);

I’ve also tried it with an external font in case that is the issue (is this the right way to load a custom font?);

DocX.ConvertToPdf(doc, saveStream, externalFonts: new System.Collections.Generic.List() { new Xceed.Document.NET.PdfExternalFont() { Name = "Noto Sans SC Regular", Path = "C:\Users\Luke\Downloads\Noto_Sans_SC\NotoSansSC-Regular.ttf" } });

XceedBoucherS commented 3 years ago

Hi, I believe you already got an answer from support@xceed.com. If not, conversion to PDF is actually not supported for language with special characters( like Chinese). Some indexing problems may occurs because special characters have higher index values. This is something which will be addressed in the future based on the demand. Thank you.