How to set a custom color in itext?

后端 未结 3 1638
你的背包
你的背包 2021-02-20 15:26

Thanks for taking the time to answer my question.

I\'m generating a PDF document using iText in Java. I need to set the column headers of a table a different colour than

相关标签:
3条回答
  • 2021-02-20 16:03
    Cell hcell = new Cell();   
    Color color = WebColors.getRGBColor("red");
    hcell.setBackgroundColor(color);
    
    0 讨论(0)
  • 2021-02-20 16:14

    You'll need to take your 8-bit hexadecimal color value and convert it to 8-bit RGB values.

    How to convert hex to rgb using Java?

    Then you'll be able to create a new BaseColor with your RGB values.

    cell.setBackgroundColor(new BaseColor(255, 0, 0));
    
    0 讨论(0)
  • 2021-02-20 16:18

    Take a look at this site. Even though it says C# there are only Java codes. Let me know if you find it or not. I created an successful PDF system looking at those examples.

    0 讨论(0)
提交回复
热议问题