Create Linear Gradient

2 posts, 0 answers
  1. Gustav
    Gustav avatar
    1 posts
    Member since:
    Jul 2015

    Posted 07 Jul 2015 Link to this post

    Dear Sirs, 

    I'm seaching for a pdf solution and found your product. Now I'm evaluating. 

    In the documentation there is an example for creating a gradient:

     http://docs.telerik.com/devtools/aspnet-ajax/controls/pdfprocessing/concepts/colors-and-color-spaces

    1.FixedContentEditor containerEditor = new FixedContentEditor(container);
    2.LinearGradient linearGradient = new LinearGradient(new Point(0, 0), new Point(30, 30));
    3.linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 207, 0), 0));
    4.linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 102, 204), 0));
    5. 
    6.containerEditor.GraphicProperties.FillColor = linearGradient;
    7.containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));

    If I copy these code I just get a monochrome rectangle filled with the color (0,102,204). 

     Any help would be fine.

     

    many thanks in advance

     

    Gustav Meier

  2. Nikolay Demirev
    Admin
    Nikolay Demirev avatar
    103 posts

    Posted 09 Jul 2015 Link to this post

    Hello Gustav,

    Thank you for writing.

    I have modified the code for generating a linear gradient:
    FixedContentEditor containerEditor = new FixedContentEditor(document.Pages.First());
    LinearGradient linearGradient = new LinearGradient(new Point(0, 0), new Point(30, 30));
    linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 207, 0), 0));
    linearGradient.GradientStops.Add(new GradientStop(new RgbColor(0, 102, 204), 1));
     
    containerEditor.GraphicProperties.FillColor = linearGradient;
    containerEditor.DrawRectangle(new Rect(10, 10, 48, 29));

    We will update the code snippet in the help article as soon as possible.

    As a token of our appreciation for reporting this I am updating your Telerik Points.

    Regards,
    Nikolay Demirev
    Telerik
Back to Top