Free Support Forum - aspose.com

Other Language text files are not converted properly to pdf using latest aspose lib

Hello,

I have converted the text file to pdf using latest version of aspose 18.3.0.0 version but for few language files it is converted properly and few other language files like korean language file is not being converted properly. Can you please help on this. Below is the code which i am using and i am attaching the source and the converted file.

   System.IO.TextReader tr = new StreamReader("D:\\Convert\\4.text");
        Aspose.Pdf.Document pdf1 = new Aspose.Pdf.Document();
        Aspose.Pdf.Document pdf2 = new Aspose.Pdf.Document();
        Aspose.Pdf.Page page = pdf1.Pages.Add();
        page.PageInfo.Margin.Left = page.PageInfo.Margin.Top = 5;
        TextFragment t2 = new TextFragment(tr.ReadToEnd());
        // set the font size for text inside PDF file
        t2.TextState.FontSize = 12;
        // add text to paragraphs collection of section object
        page.Paragraphs.Add(t2);
        pdf1.Save("D:\\Convert\\3.pdf");

Files.zip (152.6 KB)

@pradeepdone,

We have tested your scenario in our environment and it is working fine. This is the output PDF document: Output.pdf (233.5 KB)

The Korean font may not available on your System. We can also find an Evaluation watermark in your output PDF and it is because you have not applied a valid license. You can get a 30 day temporary license from the purchase portal and its option is available in step 5. You will view a button with caption Get a Temp License in step 5 of the purchase portal. A temporary license is a time-restricted full license that lets you test every aspect of API before buying it. Please refer to this help topic: Apply License to Aspose.PDF for .NET API

I do have a valid license already .Even after applying the valid license I am facing the same issue.

@pradeepdone,

Did you install Korean font in the System? You can download the required fonts from the internet, and then specify the font directory in the font folder list as follows:
C#

// connect custom font directory
FolderFontSource fs = new FolderFontSource(@"path\to\my\folder");
FontRepository.Sources.Add(fs);

i have installed korean font but still facing the same issue.

@pradeepdone,

Kindly create a small project application which reproduces this issue in your environment, and then send us a ZIP of this project along with font files. Please also let us know which Aspose.PDF for .NET API version you are using.

I don’t want to hard code the Font source path in the code, which may cause issue moving further for other language files. Is there any way that it can work out.

@pradeepdone,

It is an environment specific problem which is not reproducible in our System. Kindly send all details of the System environment, including .NET framework, IDE, the local language settings, Operating System (name & edition) and some handy information which could help us to replicate the same problem in our environment. Please also create a small project application which reproduces this issue in your environment, and then send us a ZIP of this project along with font files as requested in the previous post.

If the Korean font is installed in the default path of the Operating System, then it is fine. After including a custom directory path, Aspose.PDF API can read fonts from both default Operating System and custom directory paths.