【发布时间】:2015-12-23 10:24:11
【问题描述】:
我正在尝试在 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?)那样修改坐标并没有解决问题。我也尝试旋转文档,但效果不佳。
【问题讨论】: