RTF to PDF - Hebrew text becomes gibberish

Hello,

I’m trying to convert RTF document to PDF using 17.12 version. Document contains Hebrew text, and when I’m doing the conversion the text becomes unreadable.
Except for some margin adjustments etc. I’m using plain conversion like this:

Document document = new Document(lppIn.ShortPath);
document.Save(lppOut.ShortPath, AsposeWords.SaveFormat.Pdf);

Can you please check the attached document and advise what can I do?
Best regardsInputFile.zip (3.3 KB)

@mohamed13,

Thanks for your inquiry. 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 that are used in your document on the machine where you’re converting documents to Pdf. Please refer to the following article:

How Aspose.Words Uses True Type Fonts

@tahir.manzoor

Thanks for your quick reply. As far as I know, this case came to me from our customer located in Israel, so I’m more than sure that there they have all the fonts they need for Hebrew?

Small hint - when I open this RTF file with Word, do nothing with it and try to close, it asks me if I want to save it. And when you do resave it, it must change it’s content in some way that then then conversion works fine. Our customer however cannot open and resave every time all of it’s documents.

Could anyone please try to reproduce this to confirm?

Big thanks,
Bart

@mohamed13,

Thanks for your inquiry. You are facing this issue due to missing font “Miriam Fixed”. Please install this font.

We have tested the scenario using latest version of Aspose.Words for .NET 18.1 and have not found the shared issue. Please use Aspose.Words for .NET 18.1. We have attached the output PDF with this post for your kind reference. 18.1.pdf (54.2 KB)

@tahir.manzoor

Hello,

I have checked on my environment using the latest 18.1 version.
Please find attached screenshot showing that the “Miriam Fixed” font is installed.
I tried to convert input file which is taken as is from the email attachment from my client without opening it (because again - opening it in MS Word and saving fixes the problem).
Conversion looks like this (now I paste exact entire method):

private void ConvertDocToPdfText(FileInfo srcFile, FileInfo destFile, ref System.Drawing.Size size)
{
    using (LongPathProxy lppIn = new LongPathProxy(srcFile, LongPathProxy.LongPathMode.Open))
    using (LongPathProxy lppOut = new LongPathProxy(destFile, LongPathProxy.LongPathMode.CreateOrNewUnsure))
    {
        Document document = new Document(lppIn.ShortPath);
        foreach (Section section in document.Sections)
        {
            SetupSection(section);
        }

        Node[] tables = document.GetChildNodes(NodeType.Table, true).ToArray();
        foreach (AsposeWords.Tables.Table table in tables)
        {
            SetupTable(table);
        }

        document.Save(lppOut.ShortPath, AsposeWords.SaveFormat.Pdf);
    }
}

protected virtual void SetupSection(Section section)
{
    AsposeWords.PageSetup ps = section.PageSetup;
    ps.PaperSize = (PaperSize.A4);
    ps.PageHeight = (ConvertUtil.InchToPoint(13));
    ps.Orientation = (Orientation.Portrait);

    ps.TopMargin = (15.0);
    ps.BottomMargin = (15.0);
    ps.LeftMargin = (15.0);
    ps.RightMargin = (15.0);
}

protected virtual void SetupTable(AsposeWords.Tables.Table table)
{
    if (AutoFitHtmlTable)
    {
        table.AllowAutoFit = true;
        table.PreferredWidth = (AsposeWords.Tables.PreferredWidth.FromPercent(100.00));
    }
}

But unfortunately I still get the result as on the attached screenshot. Any idea what still can be wrong?
Big thanks for your help so far!

Bart.
InputFile.zip (3.3 KB)Fonts.PNG (48.5 KB)
Result.PNG (45.5 KB)

@mohamed13,

Thanks for your inquiry. We have tested the scenario using shared document 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-16323. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-16323) have been fixed in this Aspose.Words for .NET 18.3 update and this Aspose.Words for Java 18.3 update.