HTML -> PDF Flex bug?

Hi!

I read in the documentation, regarding supported CSS features, that flexbox is supported.



When I try to convert a basic html flex box to PDF it does not work. Am i missing something?



Attached codefile should produce 3 columns with 100% width.



Regards

Per

Hi Per,

Thanks for your inquiry. WE have tested your shared HTML file and noticed that CSS flex property is not being honored in HTML to PDF conversion. So we have logged a ticket PDFNEWNET-38220 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:
“Times New Roman”;color:#333333;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>Best Regards,

Hi all,
Does this issue have any further progress or information? Our team is using aspose.words and seems we got problems on flexbox property when we wanna generate pdf and svg from html file, too. We are not sure if this is still a problem in aspose.pdf, too?
Appreciate for any response and help!

Sincerely,

@Carr

Thank you for contacting support.

We are afraid PDFNET-38220 is currently pending owing to low priority. However, you may try to convert your files and let us know if you face any problem. We will investigate further and assist you accordingly.

Hi @Farhan.Raza,
Thanks for your response!!! So it means aspose.word and aspose.pdf do not support the flex property in CSS?
Do we have any information (documentation or like sheet) on which css properties are supported in this two products? Or any product is recommended to use, and could handle modern CSS properties when I want to convert the html file to pdf and svg?

Thanks again!

1 Like

@Carr

About Aspose.PDF for .NET API, the ticket is already logged and the property will be supported once it is resolved. About Aspose.Words for .NET, kindly share respective code and sample files where you are noticing problems with flexbox property so that we may investigate and assist you accordingly.

About supported CSS properties, we are gathering details and will share our feedback with you soon.

@Carr

We would like to share with you that CSS 2.1 is fully supported except aural properties (azimuth, volume, speech-rate, etc.) because they are not supported by our output formats (XPS, Images, PDF). Regarding to CSS3 support, as you know CSS3 specification is under construction and the most chapters are far from at least stable state (CSS current work & how to participate). However, we have implemented a lot of ‘candidate’ properties when they were requested by customers.

In case you have further inquiry, please feel free to let us know. The ticket PDFNET-45979 is closed now.

It’s really nice to have your further response, I appreciate it very much!
I think CSS 2.1 is good enough for our product! I look back to this
thread and have two points I want to make sure, the support is only for ASP.NET library?
Is it supported in Aspose.Words, Java library?

@Carr

Thanks for your kind feedback.

As far as Aspose.PDF is concerned, similar support is available in both .NET and Java version of the API. Regarding Aspose.Words, we will be updating you soon.

@Carr,

Regarding Aspose.Words, please ZIP and upload your simplified HTML document and a screenshot highlighting the problematic areas in Aspose.Words generated document here for testing. We will then investigate the issue on our end and provide you more information.

A post was split to a new topic: Convert HTML to PDF CSS 3 or CSS 2.1 compatibility

The issues you have found earlier (filed as PDFNET-38220) have been fixed in Aspose.PDF for .NET 22.5.

Excellent!
I have been waiting 7 years for this :slight_smile:
Free support for the win ! :wink:

Is this available in Aspose.Pdf.Drawing 23.8 as my PDF is broken when converting from an HTML contains flexbox? Please see the attached html and generated pdf.
files.zip (92.2 KB)

@sreeraj.thottipparambil.tpr

Can you please share the sample code snippet that you have used for the conversion? We will further proceed to assist you accordingly. Also, you can try Aspose.Pdf.Drawing as well because you would not be needing any special license for it. It will work with your existing license.

@asad.ali I’m using Aspose.Pdf.Drawing only. In bo the cases flex is not working. Please find the code snippet below:

public byte[] ConvertHtmlToPdf(string htmlContent)
{
    using var memoryStream = new MemoryStream();
    using var htmlStream = new MemoryStream(Encoding.ASCII.GetBytes(htmlContent));

    var options = new HtmlLoadOptions
    {
        CustomLoaderOfExternalResources = new LoadOptions.ResourceLoadingStrategy(LoadResource)
    };

    var document = new Document(htmlStream, options);
    document.Save(memoryStream);
    return memoryStream.ToArray();
}

private LoadOptions.ResourceLoadingResult LoadResource(string resourceURI)
{
    byte[] contentData = GetContentFromUrl(resourceURI);
    return new LoadOptions.ResourceLoadingResult(contentData);
}

private byte[] GetContentFromUrl(string url)
{
    return _client.GetByteArrayAsync(url).GetAwaiter().GetResult();
}

@Eneuman

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): PDFNET-55477

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.

Thanks @asad.ali