Link to home
Start Free TrialLog in
Avatar of tpnguyen
tpnguyen

asked on

printing a postscript file to a printer from within MFC application

Assume I already had a postscript file, now I need to print it to a printer from my MFC application. How can I do it?   Normally I do this on UNIX:
        sprintf(printstr, "lpr %s   %s", filename, printer);
        system(printstr);

I have tried the below on NT 4.0, however, the DOS box always shows up, and I did not want that.
        sprintf(printstr, "copy %s  %s", filename, printer);
        system(printstr);
Thank you,
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

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
Avatar of tpnguyen
tpnguyen

ASKER

Thank you very much for the details.   It is very helpful.
-Thang
One other thing - if you have installed an application which is already registered as the default application for handling PS files (you can see it when the explorer refers to them as 'PostScript File' rather than 'PS-File'), it might be easier to use

ShellExecute ( NULL, "print", "<path to file>.ps", NULL, NULL, SW_HIDE);