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

Printing Grid with Logo in RadPrintDocument Footer

7 Answers 184 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kurt Boyer
Top achievements
Rank 1
Kurt Boyer asked on 31 Dec 2014, 05:54 PM
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?

7 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 02 Jan 2015, 12:14 PM
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.

 
0
Kurt Boyer
Top achievements
Rank 1
answered on 04 Jan 2015, 10:47 PM
This works perfectly. Thank you very much.
0
amir
Top achievements
Rank 1
answered on 01 Mar 2016, 04:59 PM

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 

0
amir
Top achievements
Rank 1
answered on 01 Mar 2016, 05:00 PM
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();
0
Stefan
Telerik team
answered on 02 Mar 2016, 07:14 AM
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
0
amir
Top achievements
Rank 1
answered on 02 Mar 2016, 11:52 AM

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

 

0
Stefan
Telerik team
answered on 02 Mar 2016, 03:47 PM
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 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
Tags
GridView
Asked by
Kurt Boyer
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Kurt Boyer
Top achievements
Rank 1
amir
Top achievements
Rank 1
Share this question
or