简体   繁体   English

C#Crystal Reports打印页面大小不正确

[英]C# Crystal Reports Printing Page Size Incorrect

I'm developing ac# program to print Crystal Reports document. 我正在开发ac#程序来打印Crystal Reports文档。 The program takes rpt raw file and send it to printer. 该程序获取rpt原始文件并将其发送到打印机。

ReportDocument crrpt = new ReportDocument();
crrpt.Load(pathtorptfile);

crrpt.PrintOptions.PrinterName = settings.Print_printer;
crrpt.PrintToPrinter(1, false, 0, 0);

The above code can print. 上面的代码可以打印。 The problem is the page size does not seem correct. 问题是页面大小似乎不正确。 It is different from the page size in the rpt file (when opened in Crystal Reports). 它与rpt文件中的页面大小(在Crystal Reports中打开时)不同。

When opened in Crystal Reports, the size is half A4 (which is what I need). 在Crystal Reports中打开时,大小为A4的一半(这是我需要的)。 And printing it within Crystal, also gives the half the page. 并将其打印在Crystal中,也可以得到一半的页面。 However, when I print with above code, it prints in top half page and leave the bottom half page empty. 但是,当我使用上述代码打印时,它将在上半页打印,而将下半页留空。 (Sample http://imgur.com/rPX9bep ). (示例http://imgur.com/rPX9bep )。

Printing within Crystal Reports (on the left - one I need) vs Printing with above code (on the right). 在Crystal Reports中打印(在左边-我需要一个)与在上面代码中打印(在右边)。

Appreciate any helps. 感谢任何帮助。 Thanks in advance. 提前致谢。

Set your default printer paper size to A5 and orientation to landscape. 将默认打印机纸张尺寸设置为A5,方向设置为横向。 Which you are using in printing code. 在打印代码时使用的代码。 And then try again. 然后再试一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM