我正在尝试在iTextSharp pdf文档底部绘制垂直渐变:
PdfShading shading
= PdfShading.SimpleAxial(pdfWriter, 0, document.PageSize.Height,
document.PageSize.Width, 0, BaseColor.WHITE, BaseColor.GREEN);
PdfShadingPattern pattern = new PdfShadingPattern(shading);
pdfContentByte.SetShadingFill(pattern);
pdfContentByte.Rectangle(0, 0, document.PageSize.Width, 70);
pdfContentByte.Fill();
这将在我想要创建的确切位置创建一个渐变,但渐变是从左侧(白色)到右侧(绿色)的水平渐变。
我希望渐变是从顶部(白色)到底部(绿色)的垂直渐变。
修改坐标,就像某人在这里所做的那样 (Does iTextsharp support multi color diagonal gradients?),没有解决问题。我还尝试旋转文档,但也不起作用。