I recently updated a Crystal Report from an unknown version to v13. This report prints to a Zebra TLP2844 label printer using 6"x4" labels (6" long, 4" wide as they come out of the label printer). Before the update, everything worked fine. Afterwards, I cannot print the labels in landscape. No matter what settings I use, I always get portrait.
Here are the settings I have in Visual Studio 2010:
My printing code:
public void print_label(CTapeID myTape)
{
_myTape = myTape;
LabelReport crystalPrint; // name of report class
CPrinterObject po;
CPrinterInfo pi;
String printerType = "LABEL_4060";
LabelInfo cpd; // name of dataset class for the report
try
{
crystalPrint = new LabelReport();
crystalPrint.ReportOptions.EnableSaveDataWithReport = false;
po = new CPrinterObject();
pi = po.FindPrinter(printerType);
if(pi != null)
{
crystalPrint.PrintOptions.PrinterName = pi.PrinterName;
}
crystalPrint.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
cpd = GetLabelData();
crystalPrint.SetDataSource((DataSet)cpd);
crystalPrint.PrintToPrinter(1, false, 1, 0);
crystalPrint.Close();
crystalPrint.Dispose();
}
catch(Exception ex)
{
ex.Source = MethodBase.GetCurrentMethod().Name + "(): " + ex.Source;
throw ex;
}
}
CPrinterObject
and CPrinterInfo
are internal classes that get the printer name and properties.
crystalPrint.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait;
. Shouldn't this readcrystalPrint.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
? – craig