Skip to Content
avatar image
Former Member

different result when print using crystal report viewer and PrintOutputController.PrintReport


I'm using VS 2015

and CR v13,SP16

i am using user defined paper 12 x 14 cm,

when print using PrintOutputController.PrintReport the result become smaller than it should be.

when print using CRViewer the result is good and as it should be. but user must set the preferences to user defined paper size and the other printer setting. even though my default setting from control panel has been set.

is there anyways to make it programatically sett all of the properties?

datasource for R is setted with another function.

this is my printing code

PrintDocument pDoc = new PrintDocument();

PrinterSettings dPrinterSett = new PrinterSettings();

PageSettings dPageSetting = new PageSettings();

PrintOptions printOption = R.ReportClientDocument.PrintOutputController.GetPrintOptions();

printOption.DissociatePageSizeAndPrinterPaperSize = false;

printOption.PaperSize = CrPaperSizeEnum.crPaperSizeUser;

printOption.PrinterDuplex = CrPrinterDuplexEnum.crPrinterDuplexSimplex;

PrintReportOptions printReportOption = new PrintReportOptions();

printReportOption.PaperSize = CrPaperSizeEnum.crPaperSizeUser;

printReportOption.Collated = true;



R.ReportClientDocument.PrintOutputController.ModifyUserPaperSize((dPageSetting.PaperSize.Height * 1440/100), (dPageSetting.PaperSize.Width * 1440/100));

if (pDoc.DefaultPageSettings.PaperSize.Height > pDoc.DefaultPageSettings.PaperSize.Width)









Any Help is appreciated,


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Apr 04, 2016 at 12:56 PM

    Paper size must be defined on the printer before sending to the printer. CR looks for the custom paper size ENUM, if not found it looks for the Custom Paper Size by name, so make sure all of the printers have that paper size created on each PC and using the same Name.

    Search for KBA 2163438 and it has a test app to print, see if that works for you.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 04, 2016 at 03:07 PM

    Thankyou so much for your help,

    finally the problem has been solved.

    all this time i just need the enum number. and because your code it's all clear now

    Thanks alot Don.

    and this is my code if someone need it.

    PrintDocument pDoc = new PrintDocument();

    PrinterSettings dPrinterSett = new PrinterSettings();

    PageSettings dPageSetting = new PageSettings(dPrinterSett);

    PrintLayoutSettings dPrintLayout = new PrintLayoutSettings();

    //set printer name

    dPageSetting.PrinterSettings.PrinterName = dPrinterSett.PrinterName;

    //set printer paper size

    int myEnum = getPaperSizeRawKindByName("12x14");

    //set Rpt.PrintOption

    R.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)myEnum;

    R.PrintOptions.PrinterName = pDoc.PrinterSettings.PrinterName;

    R.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;


    R.PrintToPrinter(dPrinterSett, dPageSetting, false, dPrintLayout);

    function to get the enum(rawKind)

    private int getPaperSizeRawKindByName(string name)


    PrintDocument pDoc = new PrintDocument();

    int result = -1;

    foreach (System.Drawing.Printing.PaperSize x in pDoc.PrinterSettings.PaperSizes)


    if (x.PaperName == name)

    result = x.RawKind;


    return result;


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Wai,

      Can you start a new thread, this one was resolved.

      Check your printer driver and spooler or check you report, use a report with saved data, that way it doesn't hit the DB which could slow things down.