Page 1 of 1

Strange behaviour when printing an MRT file

Posted: Fri May 14, 2010 8:52 am
by Brendan
Hi,

I've come across some strange behaviour when printing an mrt file after the SaveDocument method is called.
The print output to paper seems to be pushed slightly more to the right and down from the top left position of the page.

Here are some basic steps to reproduce the issue:
Load the attached MRT file from code. It is just a standard A4 template with one line of text.

Load the mrt file, save it as an mdc document to the local disk and then call print on the mrt file

Code: Select all

StiReport report = new StiReport();
report.Load(@"S:\A4Template.mrt");
report.Info.Zoom = 1.0d;
if (!report.IsRendered)
{
    report.Render(false);
}

//Save report to mdc file
report.SaveDocument(@"S:\A4Document.mdc");

report.Print(true);
With the print dialog, print to a physical printer. I've tested with a HP and others and the same issue occurs.

Now repeat the same process again but comment out the following line

Code: Select all

//Save report to mdc file
//report.SaveDocument(@"S:\A4Document.mdc");
The output should print correctly this time without the position shifting occuring if you compare the two paper outputs on top of one another.


I've tested the code using 2006.4, 2009.3 and 2010.1 and I experience the same issue using all versions.
Am I missing something simple?

Strange behaviour when printing an MRT file

Posted: Sun May 16, 2010 6:15 pm
by Ivan
Hello,

Sorry for the delay with response.
We need more time to prepare the answer for you.

As a workaround, please set the ReportUnit property of your report to HundredthsOfInch.

Thank you.

Strange behaviour when printing an MRT file

Posted: Mon May 17, 2010 6:10 am
by Andrew
Hello,

We made some improvements in that direction.
Please check the next prerelease build from 17-May-2010 when it will be available and let us know about the result.

Thank you.

Strange behaviour when printing an MRT file

Posted: Tue May 18, 2010 4:58 am
by Brendan
Thanks for the patch.

I gave it a test on some printers. Printing with the original code seems to fix the top margin starting location of the print job. However the left margin is still being pushed off by a few millimeters.

Setting:

Code: Select all

report.ReportUnit = StiReportUnitType.HundredthsOfInch;
before calling

Code: Select all

report.Print(true);
corrects this offset as a workaround for now.

If you run these two code blocks as separate calls, the print output will be slightly different from the left margin.

Code: Select all

StiReport report = new StiReport();
report.Load(@"S:\A4Template.mrt");
report.Info.Zoom = 1.0d;
if (!report.IsRendered)
{
    report.Render(false);
}

//Save report to mdc file
report.SaveDocument(@"S:\A4Document.mdc");

report.Print(true);

Now reload the mdc file and reprint it

Code: Select all

StiReport document = new StiReport();
document.LoadDocument(@"S:\A4Document.mdc");
document.Info.Zoom = 1.0d;
document.Print(true);

Strange behaviour when printing an MRT file

Posted: Wed May 19, 2010 9:48 am
by Andrew
Hello Brendan,

We couldn't reproduce this bug in the patch.
Maybe we do not take into consideration some factors to reproduce the error.
Please, let us know the following information: Windows version (XP / Vista / Seven / Server2003 / Server2008 , 32 / 64 bit), and regional settings.

Thank you.

Strange behaviour when printing an MRT file

Posted: Thu May 20, 2010 11:09 am
by Brendan
Yes, I think it's working ok now.
I may have had an old cache of dlls belonging to the previous build in the debug folder.
I gave it another try with XP and Vista and printouts were correct.

Thanks.

Strange behaviour when printing an MRT file

Posted: Fri May 21, 2010 1:22 am
by Ivan
Hello,

We are always glad to help you.
Let us know if you need any additional help.

Thank you.