Printing files

Post Reply
chiaiese
Posts: 56
Joined: Wed Feb 08, 2006 10:32 pm
Location: Roma, Italia
Contact:

Printing files

Post by chiaiese »

I know it is possible to print a file using ShellExecute() but it prints to the default printer.
There is a way to redirect the print to another printer ?
I need to print various types of files to a specified printer (doc rtf pdf ecc.)
chiaiese
Posts: 56
Joined: Wed Feb 08, 2006 10:32 pm
Location: Roma, Italia
Contact:

Post by chiaiese »

Enrico,
thanks for your answer

however I have found this other way that is simpler than setting and then restoring the default printer:

ShellExecute(0,"PrintTo",cMyDocument,"PDFCreator",0,1)

Roberto
chiaiese
Posts: 56
Joined: Wed Feb 08, 2006 10:32 pm
Location: Roma, Italia
Contact:

Post by chiaiese »

On one PC *only* I have this problem:

though I have set wordpad as the standard app to open rtf files, when I issue the ShellExecute(0,"PrintTo",cMyDoc,cMyPrinter0,0) statement, the document is printed using MsWord
If I double-click the rtf file, then WordPad is used
Normally the application used to open the file is the same that is used to print it. How can I force printing using WordPad ?

Roberto
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

Check the properties of the RTF extension association. Specifically, look inside Open method. Try to compare it with those of a working PC.

EMG
chiaiese
Posts: 56
Joined: Wed Feb 08, 2006 10:32 pm
Location: Roma, Italia
Contact:

Post by chiaiese »

do you mean by right-clicking the file, or something else in the windows registry (or INI file) ?
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

No, Tools -> Folder options -> File types (Strumenti -> Opzioni cartella -> Tipi di file in Italian).

EMG
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

ShellExecute(0,"PrintTo",cMyDocument,"MyPrinter",0,1)

works well, but it prompts the user to select the printer. Is there a way to just print directly with out the PrintSetup screen?
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
chiaiese
Posts: 56
Joined: Wed Feb 08, 2006 10:32 pm
Location: Roma, Italia
Contact:

Post by chiaiese »

It should not prompt the user.
Check for the correct printer name as you find it in the printer folder

regards
Roberto
Roberto Chiaiese
R&C Informatica S.n.c.
http://www.recinformatica.it
info@recinformatica.it
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

It definitely prompts the user.

I even tried:

ShellExecute( 0, "PrintTo", cHTMOut, PrnGetName() , 0, 1 )

? PrnGetName()
reports the correct name.
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Post Reply