cancel
Showing results for 
Search instead for 
Did you mean: 

CrystalReportViewer doesn't respect paper size when printing?

Former Member
0 Kudos

We've come across an issue when our users preview a report using the CrystalReportsViewer and then print it.  The report is designed for A4 paper size.  It previews fine, and displays fine, but when the user prints from the CrystalReportsViewer window, the report gets printed out Letter paper size.  This does not occur when printing the report directly using the report.PrintToPrinter() method.  The report is the same report being used in both prints.  Is this a known issue?  Is there a workaround, or something being done wrong?  Thanks!

Kyle

P.S. We use Crystal Reports for VS2010.  I believe the customer is using 13.0.1.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Kyle,

This is by design. Have the users set their default printer to one that was used when the report was designed. And then set the default paper sizes to the same A4 size. May require installing the same Printer as you are using.

You could try setting the Dissociate... and or the No Printer options as well in the report and test again.

Don

Former Member
0 Kudos

Can you explain this a little more?  How can I develop a report in A4 and then ship it to the customer, who doesn't have the printer?  Use the disassociate option?  Are there performance implications?  Can the disassociate option be set programmatically?  Thanks.

Kyle

0 Kudos

Hi Kyle,

CR changed the way it handles printers as of CR 2008. Best way I've found is to find out what printer they are using and then simply install it on your PC. Set it to Pause so it doesn't go anywhere then you can simply delate all the print jobs. Typically if the Printers are of the same class they should work. Be careful using printers that do not have A4 as a default paper size, they won't work with CR, but most should work fine.

Yes you can set Dissociate at runtime, look in the object browser for the API.

No performance issues in CR, their Network would be the only problem if they are using a network print server. Locally it won't make any difference.

I've post a fair amount of sample code on using printers, here's part of it. YOU MUST make sure you are printing the same report object you set the cahnge to:

 

private void btnSetPrinter_Click(object sender, System.EventArgs e)
{
    System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
    CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions();
    CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions newOpts = new CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions();

    newOpts.DissociatePageSizeAndPrinterPaperSize = false;

    if (rdoCurrent.Checked)
    {
        newOpts.PrinterName = cboCurrentPrinters.SelectedItem.ToString();

        newOpts.PaperSize = (CrPaperSizeEnum)cboCurrentPaperSizes.SelectedIndex;
        newOpts.PaperSource = (CrPaperSourceEnum)cboCurrentPaperTrays.SelectedIndex;
    }
    else
    {
        pDoc.PrinterSettings.PrinterName = cboDefaultPrinters.Text;

        newOpts.PrinterName = cboDefaultPrinters.Text;
        newOpts.PaperSize = (CrPaperSizeEnum)cboDefaultPaperTrays.SelectedIndex;
        newOpts.PaperSource = (CrPaperSourceEnum)cboDefaultPaperTrays.SelectedIndex;
    }

    rptClientDoc.PrintOutputController.ModifyPrintOptions(newOpts); }

}

Don

Former Member
0 Kudos

Thanks. Is there a reason why it is designed this way?  It seems that the preview window should respect the paper size the report was designed with.  It puts us in a tough spot, since we distribute 300 default reports that were designed in the office.  There's no way the customer's would have the same printers.  On the other side, there's no way the customer would want to customize 300 reports for their printers.

What do you mean by be careful using a printer that does not have A4 as the default paper size?

Thanks again.

Kyle

0 Kudos

We asked our Developers the same thing. We don't know what the reason was, may have something to do with the Section Print Orientation option but just a guess here.

I did discover that CR looks for the Printer Name as seen in the Printers and Devices in Windows. So if you tell them the name of your printers they can simply name theirs the same and in theory it should work for them.

The warning is for some printers do not support A4 paper size. But since that typically is in all printer drivers it's not something to be concerned about.

I'm working with R&D and PM's to try to find a solution for all.... Not just paper size but Label printers also.

Don

ido_millet
Active Contributor
0 Kudos

Don, this note is just to indicate these problems impact my users as well.
I hope the solution gets prioritized for release in SP4.

Former Member
0 Kudos

Thanks Don.

So, let me see if this all makes sense and you can confirm it for me?

PrintToPrinter() respects the paper size.

Displaying in the Crystal Reports Viewer will respect the paper size.

Printing from the Crystal Reports Viewer will not respect the paper size.

To get the Crystal Reports Viewer to respect paper size there are three options that work:

1. Disassociate the printer in the report.

2. Customize the report for the exact printer being used.

3. Match the name of the printer the user is using to the name of the printer in the report.

Is that right?  Thanks.

Kyle

0 Kudos

Hi Guys,

Yes, that is what I am seeing also.... sometimes... If you save the printer with the Report it does work, this does require you to have your users using the exact same printer name...

I've done even more testing and I am getting a clear picture of what's happening in our SDK's.

Thanks again

0 Kudos

This issue has now been fixed in SP 5

Don

Answers (0)