0

I want to apply a linear gradient to my header but don't know how.

styles.LoadStyle("RequestID", "style", "font-size: 15px; text-align: justify; font-family: calibri;");

Can I directly use gradient or linear gradient attribute?

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
  • If you are using `LoadStyle` then you are using `HTMLWorker` which, despite appearances, doesn't really support CSS and is no longer supported. See [this post](http://stackoverflow.com/a/25164258/231316), specifically the fifth paragraph for more information on that. That said, upgrading to `XMLWorker` probably won't help you in this case because gradients are tricky. See [this post](http://stackoverflow.com/a/7688965/231316) for creating a gradient by hand. – Chris Haas Sep 30 '14 at 13:20
  • THANKYOU for the information @Chris Haas... is we have any simple and better way to apply gradient? .. – Suman Neppalli Oct 01 '14 at 06:54
  • No. I'd recommend keeping PDF and HTML separate in your mind. iText provides convenience methods to translate HTML into raw PDF commands but many HTML concepts don't make sense in a PDF and many PDF concepts have no way of being expressed in HTML. As wonderful and convenient as iText's HTML parsers you will always be able to do so much more by skipping HTML completely and using iText's native API. – Chris Haas Oct 01 '14 at 13:34

0 Answers0