Link to home
Start Free TrialLog in
Avatar of moby59
moby59

asked on

Shell32.dll print : what are the parameters ?

Hi

I need to print a prdf file without human intervention... so i did the following program in c# :

[DllImport("shell32.dll")]
private static extern int ShellExecuteA(IntPtr hwnd,string operation,string file,string paramters,string directory,int showcmd);
string fichier_local = @"d:\csharp\toto.pdf" ;
if (fichier_local != null) ShellExecuteA(IntPtr.Zero, "print", fichier_local, null, null, 0);

it works like a charm, but it prints to the default printer, and the default tray.
I need to specify the printer and more important the tray.

In fact the program has to print 3 pdf files,
- one using normal paper tray 1,
- one using special paper in tray 2
- one using another paper in tray 3

Could you help me ?
Avatar of Chester_M_Ragel
Chester_M_Ragel

This may help you..
https://www.experts-exchange.com/questions/21012246/Printing-To-default-printer.html

I Don't have any experience with this. Anyway I'm sure that you must specify the printer and tray in  

ShellExecuteA(IntPtr.Zero, "print", fichier_local, null, null, 0);

It must be the 1st parameter. The first parameter must be changed and you must pass the handle to the printer which you want to printer.
Avatar of moby59

ASKER

no real answer given :-(

I made a VB6 program and changed the default system printer, then print, then change the default printer...

ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial