April 29th, 2003, 01:16 PM
How to print MS Word document using C?
We are trying to print a MS Word document using C program. We can print a text documents, but not the Word document. Everytime we try to print a Word document it try to print as text document. Sample code will be appreciated.
April 29th, 2003, 03:41 PM
Assuming you're using a windoze compiler such as Visual C++ or Borland C++ or Borland C++ Builder, try using this:
You'll also need to add shell32.lib to the list of libraries to link to, if your project doesn't already do this.
... in your print function ...
ShellExecute(NULL, "print", "path\\to\\file", NULL, NULL, SW_HIDE);
See http://msdn.microsoft.com/library/de...ellexecute.asp for documentation on the ShellExecute function. Hope this helps :)