ceTe.DynamicPDF.RgbColor

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4.x)  /  Display Thread

DynamicPDF Generator for .NET (v4.x) Forum

 Nov 12 2007 11:05 AM
I am trying to create a simple pink rectangle but the following code DOES NOT give ne a pink colour.

What am I doing wrong. All you have to do is set Red, Green and Blue.

Looks like a bug...... :-(

dim colour as ceTe.DynamicPDF.RgbColor = New ceTe.DynamicPDF.RgbColor(255, 0, 255)

None of the below have worked.

'pink 255 20 147         
'pink 255, 105, 180, 
'pink 255, 192, 203, 
'pink 255, 182, 193,
'pink 255,  20, 147,

Regards,

Preetinder Chagger
 Nov 12 2007 11:41 AM
Posted by a ceTe Software moderator
Hello Preetinder,

We are able to create a rectangle with the color RgbColor(255, 0, 255) without any problem. Please make sure that you are using the latest build of our product. We have used the other color combinations also without any problem. Following is the code we used to create this rectangle.

        Document doc = new Document();
        Page page = new Page();
        Rectangle rec = new Rectangle(10, 10, 100, 100);
        RgbColor col = new RgbColor(255, 0, 255);
        rec.BorderColor = col;
        page.Elements.Add(rec);
        doc.Pages.Add(page);
        doc.DrawToWeb();

Thanks,
ceTe Software Support Team.
 Feb 07 2018 1:10 PM
This doesn't work.  Intelsense says rgbcolor() takes intergers but at run type DynamicPDF throws a GeneratorException saying RGB values must be from 0.0 to 1.0.
 Feb 08 2018 12:46 PM
Posted by a ceTe Software moderator
Hello,

Converting the integer values into respective RGB float values should work. Here is the code:

        Dim MyDocument As Document = New Document()
        Dim MyPage As Page = New Page()
        MyDocument.Pages.Add(MyPage)
        Dim rect As Rectangle = New Rectangle(50, 500, 150, 75)
        Dim redValue As Single = 128 / 255
        Dim greenValue As Single = 0 / 255
        Dim blueValue As Single = 0 / 255
        rect.FillColor = New RgbColor(redValue, greenValue, blueValue)
        MyPage.Elements.Add(rect)
        MyDocument.Draw("C:\Temp\MyDocument.pdf")

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 9:05 AM.