This is a migrated thread and some comments may be shown as answers.

Cannot set the text foreground color in a PDF TableCell

4 Answers 297 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
Roland asked on 03 Nov 2020, 03:01 AM

block.GraphicProperties.StrokeColor = color;

seems to do nothing

4 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 04 Nov 2020, 12:14 PM

Hello Roland,

This is the color used for the border of the shape that is drawn. You need to set the IsStroked property as well. Here is an example that shows how you can test this: 

var document = new RadFixedDocument();
var page = document.Pages.AddPage();
var editor = new FixedContentEditor(page);

Block block = new Block();
block.GraphicProperties.StrokeColor = new RgbColor(255, 0, 0);
block.GraphicProperties.IsStroked = true;
block.InsertRectangle(new Rect(0,0,100,100));


editor.Position.Translate(100, 100);
editor.DrawBlock(block);

var provider = new PdfFormatProvider();
File.WriteAllBytes(@"..\..\result.pdf", provider.Export(document));

Let me know if you have any other questions.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 21 Nov 2020, 01:42 PM
setting the GraphicProperties does not work for inserting text
0
Dimitar
Telerik team
answered on 23 Nov 2020, 10:05 AM

Hi Roland,

For text, you can use the TextProperties.HighlightColor for the background color and GraphicProperties.FillColor for the ForeColor, here is an example: 

Block block = new Block();

block.TextProperties.HighlightColor = new RgbColor(255, 0, 0);//Background
block.GraphicProperties.FillColor = new RgbColor(0, 255, 0);//ForeColor

block.InsertText(new FontFamily("Segoe UI"),"Test");

Can you test this example on your side and see if it is working? 

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 23 Nov 2020, 05:28 PM
GraphicProperties.FillColor works indeed, thanks
Tags
PdfProcessing
Asked by
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Dimitar
Telerik team
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or