Hyphenation Problem while converting word to pdf

Our customer has been complained regarding the hyphenation problem. His word document has Hyphenations and when we convert it to pdf then Hyphenations are gone. When I try to save this docx document as pdf in ms word. Then i can see Hyphenations in the pdf file.

Here I see a topic that you said, you do not support hyphenation but i am not sure whether it is true or not or i missunderstand…

So the sample word seems like that

word.png (17.5 KB)

and here the result pdf by using ms word (save as)

pdf.png (31.3 KB)

and here what aspose make

aspose_pdf.png (30.1 KB)

as you can see there are no hyphenations in the converter pdf. I see only

HyphenationOptions.AutoHyphenation property and i make true and false but the result is the same. I saw sample that a dictionary was added for Hyphenation but i am not sure whether this is related with my problem or not.

Could you help me for this problem?

Thank you,

Regards,
Ertan

@ertan2002,

Aspose.Words supports Hyphenation. Please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words 17.11 generated PDF file showing the undesired behavior
  • Hyphenation dictionary file for the specified language.

The sample code would be as follows:

Document doc = new Document();
Hyphenation.RegisterDictionary("en-US", MyDir + "hyph_en_US.dic");
Console.Write(Hyphenation.IsDictionaryRegistered("en-US"));
doc.Save(MyDir + "Document.HyphenationEx.pdf");

thank you so much it works… but I have one more question.

The document was written in german language and when I tried

            Hyphenation.RegisterDictionary("de-DE", @"path...\hyph_de_DE.dic");

it did not work.

but this code works

            Hyphenation.RegisterDictionary("de-CH", @"path..\hyph_de_CH.dic");

I live in switzerland and my computer’s region is Switzerland and my computer language is in english. So the word document probably was created also in a switzerland region.

So considering dictionary type,it is looking for my computer region? or the machine region where the word document has been created or the word document language type?

Because in switzerland there are several offical languages (german, italian, french) and also we have turkish, english documents. So in my context I have to registry 6 dictionary (one is swiss german de-CH) in the begning?

and the second question, initializing dictironary logic works like initializing licence? Because our app supports multi-threading so begining of the conversion, can I initialize dictionaries and then not need anymore?

thank you

@ertan2002,

Please try implementing IHyphenationCallback Interface to see if you get any notifications about missing hyphenation dictionary for the specified language.

Aspose.Words’ Hyphenation API is a static API. You can specify multiple dictionaries. It will behave like a static cache of hyphenation dictionaries. This cache represents a dictionary of pairs [Language, Hyphenation dictionary], where Language is a key. In case you want to configure hyphenation options on Document level (on different threads), please use HyphenationOptions Class.