Question How to retrieve the selected papersource form a print dialog

PeterF

New member
Joined
Jul 16, 2008
Messages
4
Programming Experience
10+
I'm trying to retrieve the user selected papersource from a print dialog so i can pass it to the Crystal reports API to print a crystal report, but I can't see any property or method to do it. I can get all the papersources for the given printer so I could have another dialog box that the user selects the papersource from, but I'd like to avoid this double handling. Anyone got any clues?
 
I believe I did something like what you are talking about, and it took a lot of programming and conversions. It didn't seem like there were any properties from the printer that match the properties in Crystal.

What I did was create a combo box with the paper sources that Crystal accepts, and when a user selects a printer, it displays the sources both Crystal and the user selects.

It sounds like in your case, a user is selecting a paper source from the printer, and you want to send those details to Crystal. My general strategy was to take the size from that selection, and pass them to the Crystal part as a custom paper size. So, if a user selects an A1 paper size, take the width and height, convert it to a common size like PX if you need, and then set the Crystal component to use them.

The point is, there is no one-to-one conversion. It doesn't seem to be a standard that you can pass back an forth.

My application that does it is at this site:

http://reportviewer.biz/

Hope that helps.
 
Use pagesetupdialog instead of PrinterDialog

Hi rptfan,

Thanks for the input. I found an alternate method using the PageSetupDialog instead of the PrinterDialog. This allows access to the user selected papersource (ie the tray the paper's coming from rather than the papersize) via PageSettings.PaperSource.
This object can be directly submitted to Crystal via the ReportDocument.PrintOptions.CustomPaperSource

Convoluted as hell, but then a lot to do with Crystal appears to be.

Cheers.
 
Convoluted as hell, but then a lot to do with Crystal appears to be.

You can say that again. The Crystal API is the most poorly documented thing ever.

I will have to give your solution a try. Mine works, and but it is slow.

Peace
 
Back
Top