Html To Pdf Conversion issue in C#

First of all, I apologise for my bad English. The css does not work when reading string from html file and converting it to pdf. There is no problem in your online file conversion when converting from html to pdf.

Here are my codes. My sample html file and the resulting pdf file. xxx.zip (38.4 KB)

var html1 = File.ReadAllText(@“xxx.html”);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(html1));

byte[] result = Array.Empty();
var loadOptions = new GroupDocs.Conversion.Options.Load.WebLoadOptions
{
Format = WebFileType.Html,
};
using (var converter = new GroupDocs.Conversion.Converter((() => stream, () => loadOptions))
{
licence license = new License();
license.SetLicense(@“GroupDocs.Total.NET.lic”);

PdfConvertOptions options = new PdfConvertOptions();
converter.Convert(() => new MemoryStream(), (page, fileType, convertedStream) =>
{
    var memoryStream = new MemoryStream();
    convertedStream.CopyTo(memoryStream);
    result = memoryStream.ToArray();
}, options);

}

1 Like

@dogukan.yildiz

We couldn’t reproduce this issue at our end. Please take a look at this
output.pdf (250.7 KB). Could you please specify the API version that you are using and it’d be great if you could share the sample console application using that issue could be reproduced.

Hi, again.

The project I use .net 7 web api. For the example I moved the same codes to .net 7 console application. Thanks.

Sample_Project.zip (162.6 KB)

@dogukan.yildiz
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CONVERSIONNET-6669

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as CONVERSIONNET-6669) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov