Hello,
I am trying to use the below
Document doc = new Document("Sultan.docx");
FontSettings FontSettings = new FontSettings();
FontSettings.DefaultFontName = "Sultan normal";
FontSettings.SetFontsFolder(@"C:\MyFonts", false);
doc.Save(@"Sultan.pdf", SaveFormat.Pdf);
The fonts are embedded in the PDF however the letters aren’t displayed in the correct way, as if it couldn’t find the fonts.
I have attached fonts am working with.
Also Simplified Arabic is not working which is a windows system font.
I am using version 11.5
Thx,
Hi there,
Thanks for your inquiry. We would suggest you please upgrade to the latest version of Aspose.Words for .NET 16.5.0 and let us know how it goes on your side. If the problem still remains, please attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.
Hi Tahir,
Thank you for your reply.
I have downloaded the latest version but the issue is still there.
Attached a sample word document with sultan font.
Thx,
Hi there,
Thanks for sharing the document. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts on the machine where you’re converting documents to Pdf. Please refer to the following articles:
How Aspose.Words Uses True Type Fonts
How to Receive Notification of Missing Fonts and Font Substitution during Rendering
We suggest you please use following code example to get the desired output. Hope this helps you. We have attached the output document with this post for your kind reference.
Document doc = new Document(MyDir + "Sultan.docx");
FontSettings.DefaultInstance.DefaultFontName = "Sultan normal";
// Retrieve the array of environment-dependent font sources that are searched by default. For example this will contain a "Windows\Fonts\" source on a Windows machines.
// We add this array to a new ArrayList to make adding or removing font entries much easier.
ArrayList fontSources = new ArrayList(FontSettings.DefaultInstance.GetFontsSources());
// Add a new folder source which will instruct Aspose.Words to search the following folder for fonts.
FolderFontSource folderFontSource = new FolderFontSource(@"c:\MyFonts\", true);
// Add the custom folder which contains our fonts to the list of existing font sources.
fontSources.Add(folderFontSource);
// Convert the Arraylist of source back into a primitive array of FontSource objects.
FontSourceBase[] updatedFontSources = (FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase));
// Apply the new set of font sources to use.
FontSettings.DefaultInstance.SetFontsSources(updatedFontSources);
doc.Save(MyDir + " Out v16.5.0.0.pdf");
Well it is the same result I got and it is actually wrong.
Some letters are replaced with the word “سلطان”.Space character mainly
you could also check the following fonts already uploaded in my first post:
- Sakkal Majalla
- Simplified Arabic
- AL-Mohanad
The documents are converted however font is not correct.
Try to compare the word document with the pdf.
Thank you for your prompt reply,
Hi there,
Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the following issues at our side. For the sake of correction, we have logged these problems in our issue tracking system as follow:
WORDSNET-13856: Docx to Pdf conversion issue with Arabic font rendering
WORDSNET-13857: Incorrect Arabic words are rendering in Pdf
You will be notified via this forum thread once these issues are resolved. We apologize for your inconvenience.
Hi Tahir,
Thank you for the above.
Also please take into consideration that Justify low,medium and high in Microsoft word aren’t taken into consideration when converting the word document to PDF.
If you apply justify high to a paragraph then you convert it to PDF, the PDF remains intact without applying the necessary styling/format.
Thx,
Hi there,
Thanks for your inquiry. Could you please elaborate this detail? We will then provide you more information about your query.
If you are facing the paragraph’s formatting issue, please share code example along with problematic Pdf here for testing purpose. We will investigate the issue on our side and provide you more information.
Dear Tahir,
Kindly find attached the word document with justify high formatting.
You can also check the converted attached PDF document.
The converted PDF document text formatting is different from the word document.
Thx,
Hi there,
Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-13906. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
Hi there,
Regarding WORDSNET-13856, could you please try Unicode version of “Sultan normal” font or use some other Unicode Arabic font and share your findings? Hope this helps you.
The issues you have found earlier (filed as WORDSNET-13857) have been fixed in this Aspose.Words for .NET 16.10.0 update and this Aspose.Words for Java 16.10.0 update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
The issues you have found earlier (filed as WORDSNET-13856) have been fixed in this Aspose.Words for .NET 20.11 update and this Aspose.Words for Java 20.11 update.