Applying css while converting html to pdf using iText

16,822

You can't directly load the external css file, but you can define the styles as specifed in stylesheets using "StyleSheet" class in iText library. Please refer below URL for example.

http://itextpdf.com/examples/iia.php?id=56

Share:
16,822
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin about 2 years

    am trying to convert html to pdf on the fly. I am using iText to achieve this. I succeeded in doing the conversion as such, but am stuck at a situation where I have to apply a external CSS file to convert this HTML to PDF. I searched through the iText mailing list, google for quite sometime now. All I understood is it is not possible to apply external css files.

    Can anyone please correct me if I am wrong? Or is there a way to apply external css to convert html to pdf on the fly? Any hints on how to proceed will be much appreciated.