Crystal Report .NET font changing

crystal-reportsfontsreportdocumentzebra-printers

I've designed a crystal report that will be sent to a specific (barcode) printer through a web interface. Allowing the report to be generated in the standard crystal report viewer was causing issues, so I am now using the code-behind to send the report directly to the printer.

ReportDocument Report = new ReportDocument();                      
ParameterDiscreteValue Order = new ParameterDiscreteValue();

Order.Value = Convert.ToInt32(txtOrder);
Report.Load(reportPath);
Report.SetParameterValue("OrderNo", Order);

PageMargins margins;
margins = Report.PrintOptions.PageMargins;
margins.bottomMargin = 0;
margins.leftMargin = 0;
margins.rightMargin = 0;
margins.topMargin = 0;

Report.PrintOptions.ApplyPageMargins(margins);
Report.PrintOptions.PrinterName = "\\\\printserver\\Zebra  Z6M Plus (300dpi)";                
Report.PrintToPrinter(1, false, PageNum, PageNum);

Report.Close();

When printed from the designer (CRXI) everything works fine but when the web interface sends the job to a printer (any printer) it changes the font to Times New Roman which messes up all of the field sizes. If I use the standard .NET report viewer it uses the correct font, so I'm pretty sure the change is being caused by creating/using the ReportDocument.

How can I send the report directly to a print without it defaulting the fonts back to Times New Roman?

Best Answer

This idea occured to me:
Instead of sending the report straight from Crystal to the printer, what if you use some kind of middleman, i.e. export the .rpt to .pdf first, then print the PDF?

(Yes, it would be a very "wooden tables" tables approach, but if it works, it works.)

Related Topic