0

I'm converting from html to pdf using iTextSharp. the problem is some css style doesn't work when converted to pdf when I try something like margin-right:500px; or float:left; it doesn't work. however when I try something like color:red; it works. I'm using external css and this is how I'm converting

       MemoryStream cssStream = new MemoryStream(cssByteArray);
   MemoryStream htmlStream = new MemoryStream(htmlByteArray);
XMLWorkerHelper.GetInstance().ParseXHtml(writer,document,htmlStream,cssStream);

/*css*/
/*this one doesn't work */
 .example{
float:right;
}

/*this one doesn't work */
 .secondexample{
margin-right:500px;
}

/*this one works*/
.thirdexample{
  color:red;
}

am I missing something? does iTextSharp has full CSS support ?

Thank You

II Basil II
  • 87
  • 2
  • 10
  • 2
    iText 5 (formerly known as iTextSharp) does not have full CSS support. iText 7 (latest version 7.1.2), with the pdfHTML add-on, supports a lot more CSS. – Amedee Van Gasse May 03 '18 at 05:40
  • 1
    Please read the question [Converting HTML to PDF using iText](https://stackoverflow.com/questions/47895935), and my answer to that question. – Bruno Lowagie May 03 '18 at 11:08
  • @AmedeeVanGasse is there any document on Internet saying what CSS syntax does it support and doesn't? – sergiol Aug 09 '23 at 16:54
  • 1
    @sergiol neither myself nor Bruno Lowagie no longer work at that company and we are therefor unable to answer your question. Please contact Apryse (formerly iText) directly. – Amedee Van Gasse Aug 17 '23 at 11:15

0 Answers0