Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I enable advanced printer functionality like stapling?

Status
Not open for further replies.

dalchri

Programmer
Apr 19, 2002
608
US
I have a gestetner multifunction copier that we use as a printer on our network. It will allow you to print several copies of a job collated and stapled.

This works from Microsoft Word by selecting the printer properties in the print dialog. I have similarly encapsulated the print dialog for the crystal reports in my C# order entry app. However, the crystal reports will not print using the settings from the print dialog.

How do I enable this functionality?

Do I need to do this through crystal reports?

Do I need to do this through an API call?
 
I can't help you with the encapsulated version... But I have found that the advanced features of your printer/copier will either have to be set from crystal when you print the report(every time) OR change the default settings for stapling, duplex, etc. for the printer driver before printing the report. Crystal seems to save orientation, margins, page size, (under file/ printer setup)but not the rest of the settings within the report.
 
The best that I've been able to come up with so far is to interact with the PrintDialog and PrintDocument the way that Microsoft intended. However, this code does not print the report exactly the same way that Crystal Reports does. Some fonts, line thicknesses, and the whole page size is off:

Code:
//This is the event handler for the PrintDocument.PrintPage event
//m_rptPrint is a module level ReportClass variable
	private void PrintPage(object obj, PrintPageEventArgs evt) {
		PageRequestContext ctx = new PageRequestContext();
		CrystalDecisions.CrystalReports.ViewerObjectModel.PageObject pag = new CrystalDecisions.CrystalReports.EPFPageObjectFactory.PageObjectFactory().GetPage(m_rptPrint.FormatEngine.GetPage(ctx));

//For testing purposes, I just print out page 1
		ctx.PageNumber = 1;


		evt.Graphics.PageUnit = System.Drawing.GraphicsUnit.Inch;
		evt.Graphics.PageScale =  0.0006944445f;
		new CrystalDecisions.Windows.Forms.PageRender().Render(pag, evt.Graphics);
		evt.HasMorePages = false;
	}
 
The final solution was to set the printing preferences in the printers folder. Then the system default printer had to be set to the printer with the correct preferences before printing.

The previous solution is the same solution used by the .NET Crystal Reports Viewer when you press the print button. The problem is that the .NET Crystal Reports Viewer does not print WYSIWYG. At least not in version 9.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top