Printing Grid with Logo in RadPrintDocument Footer

8 posts, 1 answers
  1. Kurt Boyer
    Kurt Boyer avatar
    10 posts
    Member since:
    Mar 2013

    Posted 31 Dec 2014 Link to this post

    I'm having issues using the [Logo] feature when attempting to print a grid. For my test, I've got a png file at a size of 63x18 pixels and I want to place it in the LeftFooter. It does print it, but the logo is stretched instead of retaining its shape. I've attached an image of what I'm seeing.

    Here is a snippet of code I'm using in my testing.
    var doc = new RadPrintDocument();
    doc.HeaderHeight = 20;
    doc.FooterHeight = 18;
    doc.HeaderFont = new Font("Arial", 10, FontStyle.Bold);
    doc.FooterFont = new Font("Arial", 8, FontStyle.Regular);
    doc.LeftHeader = "Test Header";
    doc.Logo = System.Drawing.Image.FromFile(@"Z:\Home\Kurt\Y&M Logos\ymlogo_63x18.png");
    doc.LeftFooter = "[Logo]";
    doc.Landscape = true;
    doc.AssociatedObject = radGridView1;
    doc.Print();

    If I had the ability to set the Width of the LeftFooter, or force the size of the Logo, I'd be set, but I can't find a way to do this. Any ideas?
  2. Answer
    Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 02 Jan 2015 Link to this post

    Hi Kurt,

    Thank you for writing.

    By default the footer is divided into three regions (left, middle and right) and each region is filled with the image. This can be easily changed by creating a descendant of RadPrintDocument and overriding the PringLogo method:
    class MyPrintDoc : RadPrintDocument
    {
        protected override void PrintLogo(Graphics g, Rectangle rect)
        {
            rect.Width = this.Logo.Width;
            rect.Height = this.Logo.Height;
            base.PrintLogo(g, rect);
        }
    }

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Kurt Boyer
    Kurt Boyer avatar
    10 posts
    Member since:
    Mar 2013

    Posted 04 Jan 2015 in reply to Stefan Link to this post

    This works perfectly. Thank you very much.
  5. amir
    amir avatar
    6 posts
    Member since:
    Mar 2016

    Posted 01 Mar Link to this post

    hi i have a problem plz help me

                var document = new RadPrintDocument();
                document.HeaderHeight = 30;
                document.HeaderFont = new Font("Arial", 22);
                document.Logo = System.Drawing.Image.FromFile(@"Z:\Home\Kurt\Y&M Logos\ymlogo_63x18.png");
                document.LeftFooter = "[Logo]";
                document.LeftHeader = "[Logo]";
                document.MiddleHeader = "Middle header";
                document.RightHeader = "Right header";
                document.ReverseHeaderOnEvenPages = true;
                document.FooterHeight = 30;
                document.FooterFont = new Font("Arial", 22);
                document.LeftFooter = "Left footer";
                document.MiddleFooter = "Middle footer";
                document.RightFooter = "Right footer";
                document.ReverseFooterOnEvenPages = true;
                document.AssociatedObject = this.radGridView1;
                RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(document);
                dialog.Show();

     

       document.Logo  is misssed   and red 

  6. amir
    amir avatar
    6 posts
    Member since:
    Mar 2016

    Posted 01 Mar in reply to amir Link to this post

    hi i have a problem plz help me
                var document = new RadPrintDocument();
                document.HeaderHeight = 30;
                document.HeaderFont = new Font("Arial", 22);
                document.Logo = System.Drawing.Image.FromFile(@"Z:\Home\Kurt\Y&M Logos\ymlogo_63x18.png");
                document.LeftFooter = "[Logo]";
                document.LeftHeader = "[Logo]";
                document.MiddleHeader = "Middle header";
                document.RightHeader = "Right header";
                document.ReverseHeaderOnEvenPages = true;
                document.FooterHeight = 30;
                document.FooterFont = new Font("Arial", 22);
                document.LeftFooter = "Left footer";
                document.MiddleFooter = "Middle footer";
                document.RightFooter = "Right footer";
                document.ReverseFooterOnEvenPages = true;
                document.AssociatedObject = this.radGridView1;
                RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(document);
                dialog.Show();
  7. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 02 Mar Link to this post

    Hello Amir,

    Can you please provide more information on the issue you experience? What version of the suite do you use, what is the issue you have and how can I reproduce it?

    I am looking forward to your reply.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. amir
    amir avatar
    6 posts
    Member since:
    Mar 2016

    Posted 02 Mar in reply to Stefan Link to this post

    hi stefan

    i want to show logo in radprint document .

    but when i  type code (document.logo). visual studio show error (cannot resolve symbol 'logo') 

    please see attach files

     

  9. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 02 Mar Link to this post

    Hi Amir,

    I am not sure why you are getting an error, nor I am able to see what is the error you get from the attached screen shot. The type resides in the Telerik.WinControl.UI.dll which is base assembly for our controls and if you have it referenced you should be able to see and use this type. Using your code on my end I see no errors and I am able to use it with our latest version.

    Another possible reason is if you are using older version of the suite where this type did not exist, although it has been around for couple years. Which version are you using?

    Should you continue experiencing this error, please open a support ticket where you can attach your project, so we can review it.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready