Free Support Forum -

Problem in Arabic Character when convert Html to PDF



I have a problem when I’m trying to convert HTML contains Arabic Letters to PDF
the characters are shown separated.

you can find the result in attach.

please note that I’m using sample code from the site.

please find my code :

Capture.PNG (1.4 KB)

        string dataDir = RunExamples.GetDataDir_Data();
        String InputHtml = dataDir + "input.html";
        using (FileStream fs = File.Create(InputHtml))
        using (StreamWriter sw = new StreamWriter(fs))
                color: green;
                <div id=id1>السلام عليكم</div>
                <div id=id2 class=''st''>السلام عليكم</div><div id=id3 class=''st'' style='color: blue;'>السلام عليكم</div>
                <div id=id3 class=''st'' style='color: red;'><font face='Arial'>السلام عليكم</font></div>");

        // File name for resultant PDF file
        string Resultant_output =  dataDir + "simple-any-page_out.pdf";
        // Create PdfRendering Options object
        Aspose.Html.Rendering.Pdf.PdfRenderingOptions pdf_options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();
        // The PageSetup also provides different properties i.e. FirstPage, LastPage, LeftPage, RightPage and they are used to setup (PageSize, Margin) for every page. 
        // In most cases, usage of setup any page is enough, but in some complicated cases, you may need to fine tune page settings. It can be done either by CSS styles or by using rendering options.
        // the size for drawing is in pixels
        pdf_options.PageSetup.AnyPage = new Aspose.Html.Drawing.Page(new Aspose.Html.Drawing.Size(400, 100));
        // Instantiate PdfDevice object while passing PdfRenderingOptions and resultant file path as arguments
        using (Aspose.Html.Rendering.Pdf.PdfDevice pdf_device = new Aspose.Html.Rendering.Pdf.PdfDevice(pdf_options, Resultant_output))
        // Create HtmlRenderer object
        using (Aspose.Html.Rendering.HtmlRenderer renderer = new Aspose.Html.Rendering.HtmlRenderer())
        // Create HtmlDocument instance while passing path of already created HTML file
        using (Aspose.Html.HTMLDocument html_document = new Aspose.Html.HTMLDocument(InputHtml))
            // Render the output using HtmlRenderer
            renderer.Render(pdf_device, html_document);
        // ExEnd:HtmlToPdf



Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID HTMLNET-1862 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.