2

I discovered the font color doesn't work too well, regardless of whether it is blue, dark blue or light blue. They are still all the same color.

var FontArialRegularFilePath = @"C:\Windows\Fonts\Arial.ttf";
var fontArialRegular = pdfclownFonts::Font.Get(parmDocument, FontArialRegularFilePath);
var file = new File();

var primitiveComposer = new PrimitiveComposer(new Page(file.Document));
{
    var blockComposer = new BlockComposer(primitiveComposer);

    primitiveComposer.SetFont(fontArialRegular, 22 /*[Font-Size]*/);
    primitiveComposer.SetFillColor(new DeviceRGBColor(double.Parse("0"), double.Parse("0"), double.Parse("49")));  //Dark Navy Blue...

    blockComposer.Begin(new RectangleF(0f, 0f, 200f, 50f), XAlignmentEnum.Left, YAlignmentEnum.Top);
    blockComposer.ShowText("Listing Price");
    blockComposer.End();
}
C1rdec
  • 1,647
  • 1
  • 21
  • 46
fletchsod
  • 3,560
  • 7
  • 39
  • 65

1 Answers1

3

The OP sets the color like this:

primitiveComposer.SetFillColor(new DeviceRGBColor(double.Parse("0"), double.Parse("0"), double.Parse("49")));  //Dark Navy Blue...

So he seems to assume that the color components are given in the range 0..255. This is not the case, though, the type double is used for a reason: the actual range is 0..1.

Thus, the OP most likely wanted

primitiveComposer.SetFillColor(new DeviceRGBColor(0.0, 0.0, 49.0/255.0));  //Dark Navy Blue...

As the OP considered the resulting color to be black, here different shades of pure blue created using new DeviceRGBColor(0.0, 0.0, Blue):

different shades of blue

The originally proposed value 49.0/255.0 is nearly 0.2, i.e. a very dark blue.

I assume the OP knows that for certain blueish colors the red and green values are not 0.

mkl
  • 90,588
  • 15
  • 125
  • 265
  • That is not black but a very dark blue. I assume you also try different values for blue, don't you? – mkl Apr 16 '15 at 21:02
  • Found the problem. There were conflicting RGB value ranges found from Google search. The RGB color for Navy Blue which I finally found RGB value of 35, 35, 142 instead of 0, 0, 49 RGB value. So with your answer, it should be `new DeviceRGBColor((35.0/255.0), (35.0/255.0), (142.0/255.0))`. Glad we both found solution to this problem. What I don't understand is PDFClown source code allows DeviceRGBColor with integer parameters. Oh well. – fletchsod Apr 20 '15 at 14:13