Skip to Content
avatar image
Former Member

ReportDocument PrintOptions.CopyFrom and PrintToPrinter

I have some confusion about using PrintOptions.CopyFrom(...) followed by PrintToPrinter(....)

We distribute our application and reports to various users with various printers. To get what printer to send to the application makes a call to a standard .NET PrinterDialog. At first I was just getting the printer name and then passing that to the ReportDocument, but then a user requested functionality to allow them to change printer settings at runtime such as select a different tray or adjust color quality (etc).

I had some trouble, that I think I got worked out - but I have some confusion as to why just using PrintOptions.CopyFrom(...) by itself did not work - see following example:

' Where cr is a PrinterDocument


cr.PrintOptions.PrinterName = szPrinterName

cr.PrintOptions.CopyFrom(pPrinterSettings, pPageSettings)

' assume cr uses the settings in PrintOptions

cr.PrintToPrinter(1, False, 1, 100)

'RESULT: does NOT result in using the expected Printer Settings


cr.PrintOptions.PrinterName = szPrinterName

cr.PrintOptions.CopyFrom(pPrinterSettings, pPageSettings)

' explicitly pass the settings

cr.PrintToPrinter(pSettings, pPageSettings, False)

' RESULT: DOES result in using the expected Printer Settings

The documentation says PrinterOptions.CopyFrom "Copies the values of PrinterSettings and PageSettings into this PrintOptions"

And I have seen examples in this KB where the user called PrintOptions.CopyFrom followed byPrintToPrinter (without explicit printer and page settings).

So the question is - using the example above -

Why doesn't cr.PrintToPrinter(1, False, 1, 100) use the values set via cr.PrintOptions.CopyFrom(...) ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 02, 2010 at 06:16 PM

    Find the latest updates for your version of CR and try again. Updates are [here|]


    Add comment
    10|10000 characters needed characters exceeded