We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML to PDF generates extra bold text

Hello,

I am facing a issue while generating html to pdf which produces extra bold text in pdf.
Here is the files for your reference. HtmlBoldIssue.zip (67.5 KB)

Here is the console code for your reference.

using System;
using System.IO;
using Aspose.Html;
using Aspose.Html.Converters;
using Aspose.Html.Rendering;
using Aspose.Html.Saving;

namespace ExtraSpaceInHtmlToPdf
{
    class Program
    {
        static void Main()
        {
            try
            {
                string dataDir = @"C:\AsposeTesting";

                // Prepare a path to a source HTML file
                string documentPath = Path.Combine(dataDir, "HtmlBoldIssue.html");

                // Prepare a path for converted file saving 
                string savePath = Path.Combine(dataDir, "HtmlBoldIssue.pdf");

                // Initialize an HTML document from the file
                using var document = new HTMLDocument(documentPath);

                // Initialize PdfSaveOptions 
                PdfSaveOptions options = new PdfSaveOptions()
                {
                    JpegQuality = 100,
                }; 
                options.PageSetup.PageLayoutOptions = PageLayoutOptions.FitToContentHeight;

                // Convert HTML to PDF
                Converter.ConvertHTML(document, options, savePath);
            }
            catch(Exception ex)
            {
                Console.WriteLine("Issue in extra space with Aspose!! "+ ex.Message);
            }
        }
    }
}

@sumitworksimpli

Could you please share the screenshots of problematic sections of output PDF here for our reference? We will then provide you more information on it.

Hi @tahir.manzoor,

All the headings of sections are problematic.
Here is the screenshot of the same.
BoldIssue.PNG (74.2 KB)

@sumitworksimpli

The heading text in the HTML is bold. You can open the HTML in MS Word or Adobe writer to check it. However, the font of heading text is incorrect that looks bold. We have logged this problem in our issue tracking system as HTMLNET-3935. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.