Saurabh Mehta
Saurabh Mehta

Reputation: 23

PDFTron flex style is not applied during conversion of html string to pdf

We are trying to generate pdf from HTML String using PDFTron Java API. During this process PDF generates fine but orientation of elements is not as per expectation because below css is not applied correctly.

.flexprop {
  display: flex;
  align-items: center;
}

and we also tried below css as well but result is same as mentioned above

.flexprop {
  display: -webkit-flex;
  -webkit-align-items: center;
}

We are using PDFNet.jar and PDFNetC.dll having Product Version 8.1.1

Please help us how we can generate PDF with above css being applied correctly.

Upvotes: 0

Views: 421

Answers (1)

Ryan
Ryan

Reputation: 2570

The PDFTron HTML2PDF module does not currently support flex CSS.

As a possible alternative you could use this project.

https://github.com/PDFTron/web-to-pdf

Another alternative is to use Chrome headless directly, though for the best output (e.g. no header/footer) you would need an interface. This is a popular NodeJS interface, but there are other options for different languages+frameworks.

https://github.com/cyrus-and/chrome-remote-interface

================== 2024 Update =================

For a couple of years now PDFTron (now Apryse) does indeed support 
`flex` CSS for HTML2PDF module.

Upvotes: 1

Related Questions