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

Incorrect margins after print

3 Answers 347 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rainford
Top achievements
Rank 1
Rainford asked on 06 Nov 2012, 03:16 PM
Hi.

After set the next page settings in my report: the margins i left 5,right 5, top 5 and bottom 5, format A4 small. Print preview is correct. But after page print right margin over then left.

I thing the problem in  ReportViewerModel.Print.cs of you source code Telerik.ReportViewer.Silverlight 
There are the next method:
 static void SetPageVisual(PageInfo pageInfo, PrintPageEventArgs e, Action<Exception> onError)
            {
                try
                {
                    var printPage = GetUIElement(pageInfo.Buffer);
                    var visualRoot = new StackPanel();
                    visualRoot.Children.Add(printPage);
                    visualRoot.HorizontalAlignment = HorizontalAlignment.Left;
                    e.PageVisual = visualRoot;
                    var printTransform = new CompositeTransform();

                    printPage.RenderTransform = printTransform;
                    printTransform.TranslateX = -e.PageMargins.Left;
                    printTransform.TranslateY = -e.PageMargins.Top;

                    var printWidth = e.PrintableArea.Width + e.PageMargins.Left + e.PageMargins.Right;
                    var printHeight = e.PrintableArea.Height + e.PageMargins.Top + e.PageMargins.Bottom;

                    if (printWidth < printPage.RenderSize.Width || printHeight < printPage.RenderSize.Height)
                    {
                        var scaleFactor = Math.Min(printWidth / printPage.RenderSize.Width,
                                                   printHeight / printPage.RenderSize.Height);
                        printTransform.ScaleX = scaleFactor;
                        printTransform.ScaleY = scaleFactor;
                    }
                    visualRoot.UpdateLayout();
                    e.HasMorePages = true;
                }
                catch (Exception ex)
                {
                    onError(ex);
                }
            }
        }
Why is you set the  visualRoot.HorizontalAlignment = HorizontalAlignment.Left?

3 Answers, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 09 Nov 2012, 01:24 PM
Hi Rainford,

We have tested this locally but we were unable to reproduce any issue with the margins. I have attached the print output (xps was used as a printer;however printing the report on a real printer produced the same result).

Perhaps you are having problems with the blank space in your detail section - it may seem that the margin on the right is bigger when actually this is the margin + blank space from the report definition.

Kind regards,
IvanY
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Rainford
Top achievements
Rank 1
answered on 09 Nov 2012, 05:17 PM

Hi.

I created the report with the page format A4 landscape.In print dialog also change format  to A4 landscape. And after print the report in a real printer the right margin over then left. In you attached files in a zip archive the format is not A4 landscape.

I have attached the report and printing settings

Thanks

0
IvanY
Telerik team
answered on 12 Nov 2012, 01:01 PM
Hello Rainford,

We have tested your scenario with the landscape orientation and we were not able to reproduce any issues. Again I am attaching the output from the same report, this time using the landscape orientation. As you can see the detail section is correctly situated on the sheet (check the image with border). 

Please note that you can attach some screenshots with the problematic margins - this might help us advise you more accordingly. Also styling your detail section with a border will help seeing the issue much better. As a side note - if your report's orientation is Landscape you do not need to set it again from the print dialog every time before you print - in fact this setting will just be ignored. 

Please also note that depending on your physical printer the margins might come out differently. However this is a printer issue and therefore we cannot help you appropriately. In order to verify that the problem is indeed with the printer you can "print" your report using either PDF or XPS printers from the print dialog. If everything is correct with the output documents you most probably have issues with the printer.
 
Regards,
IvanY
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

Tags
General Discussions
Asked by
Rainford
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Rainford
Top achievements
Rank 1
Share this question
or