A strange and challenging problem: word / crystal / printing / C#

Here is my problem:

Well I am coding an application using C# for my company which requires multiple printing of Crystal Report Docs & Word Docs, at a specific

Printer of the installed Printers in the network, at a specific tray and some more settings too. Since I'm trying with the network printer I've installed a localdriver using the local port as suggested by one of the MS support site.

The definition of the Printer & Tray is happening from the code (dynamically based on the inputs given by the user thru some otherscreen ...say Maintain Printer), and there should not be a user interface (A print preview or printer settings box etc.)

Here go my attempts:

Since I need to have a common solution both for word and crystal printing I've decided to do this thru WinAPIs. so I tried to set allthe settings thru WinAPIs (SetPrinter, DocumentProperties, DEVMODE struct..) but ....

1. These settings are not reflected into the driver properties(I'm using the standard code for setting the printer settings, and myWinAPI calls are successfully executing)

2. Even if I change the settings directly thru driver properties (without programmatically....just for testing) and tried giving

printout using wordObject.PrintOut() method but this wordObject is overriding the driver settings.So the problem here is I cannot have a common approach (the enum values) both for word and crystal.Since word and crystal object's Enums are different I need to have a common solution for both word and crystal object.

WinAPIs may not be the only solution to my problem if any one find anything else that will solve my problem then I'll follow that.

I'm having one screen called "MaintainPrinter" which should capture and store (to database) all the printer informationlike printer name, Orientation, Papersource, Papersize..etc in my network. Here in what format should I store this information…like forpapersource "Tray 1", "Tray 2" …Or its enumerations 1, 2, ….

And while applying to word or crystal how I do mapping between what I stored and what it expects?This is my exact problem.

So to solve this problem I decided to go by WinAPI, since WinAPIs will act as a common solution both for Word and Crystal. Is it right ?

By using WinAPIs I'll set the necessary printer settings and make the descried printer as the default printer. And Ultimately I give printthru word object's print method or crystal object's print method. So what I thought was all the settings made thru WINAPIs will beapplicable for my current print.

[7469 byte] By [Karthikeyan] at [2007-12-16]
# 1

Hello,

Here are a few articles on Crystal and printing that may help you:

http://support.businessobjects.com/library/kbase/articles/c2014922.asp

http://support.businessobjects.com/library/kbase/articles/c2011803.asp

http://support.businessobjects.com/library/kbase/articles/c2010366.asp

I think that you will have to have different solutions for MS Word and Crystal.

You can also try contacting our support team directly:

http://support.businessobjects.com/fix/contact.asp

Online/e-mail support is free for 2 incidents if you register your product.

http://support.businessobjects.com/crystalcare/assist/default.asp

Keith - Business Objects

KeithThomson at 2007-9-9 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...

Visual Studio

Site Classified