gpt4 book ai didi

css - 如何将自定义颜色应用于 PdfPCell 的背景?

转载 作者:太空宇宙 更新时间:2023-11-04 12:02:41 25 4
gpt4 key购买 nike

我有这个 iTextSharp 代码可以为 PDF 文件中的单元格提供绿色背景:

PdfPCell cellSec2 = new PdfPCell(parSectionHeading2);
cellSec2.BackgroundColor = BaseColor.GREEN;

问题是“BaseColor.GREEN”太暗/太浓。我需要更多的铜绿颜色——浅绿色或淡绿色。是否可以将 RGB(或 RGBA)值或其他值分配给 BackgroundColor 属性?

更新

布鲁诺的回答加上this site , 你已经得到了你需要的东西。我需要:

var lightGreen = new BaseColor(204, 255, 204);
cellSec2.BackgroundColor = lightGreen;

最佳答案

我们有大量关于 iText 的文档。例如:第 10 章 my book是关于图像和颜色。如果你没有这本书的副本,为什么不看看 examples of chapter 10

DeviceColor.cs为例你有很多其他颜色的例子,例如:

new GrayColor(0x20) // Gray value
new BaseColor(0f, 1f, 1f) // RGB
new CMYKColor(0x00, 0x00, 0xFF, 0xFF) // CMYK

R、G 和 B 或 C、M、Y 和 K 的值可以是 0 到 1 之间的 float 或 0 到 255 之间的整数。

关于css - 如何将自定义颜色应用于 PdfPCell 的背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29631685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com