Printing HTML

Rafal

New Member
Hi
I would like print HTML file from Progress. I try use OCX webbrowser but I don't know method to print. I think that somebody will have some ideas :).
Rafal
 
You can simply try a Winexec with explorer.exe as the executable , passing the directory where stands your html file as a parameter. But it does not PRINT. The final user still have to click the IE print button. I never find (and never had time to search) how to launch automatically the printing with Internet Explorer.


{windows.i}

DEFINE INPUT PARAMETER c_yourhtml_dir AS CHAR NO-UNDO.
DEFINE VARIABLE c_windows_dir AS CHAR NO-UNDO.


FUNCTION GetSpecialFolder RETURNS CHARACTER (INPUT iCSIDL AS INT):

DEFINE VARIABLE op_dir AS CHARACTER NO-UNDO.
DEFINE VARIABLE ReturnValue AS INTEGER NO-UNDO.


ASSIGN op_dir = FILL (" " ,{&MAX_PATH}).
RUN SHGetFolderPathA (INPUT 0,
INPUT iCSIDL,
INPUT 0,
INPUT 0,
OUTPUT op_dir,
OUTPUT ReturnValue).
RETURN TRIM(op_dir).

END FUNCTION.

/* Search for WINDOWS dir */

c_windows_dir = GetSpecialFolder(36). /* 36 means WINDOWS dir , have a look at www.global-shared.com */

/* Launch IE */

RUN WinExec (INPUT c_windows_dir + "\explorer.exe" + " " + CHR(34) + c_yourhtml_dir + CHR(34), INPUT 1).

/* Internal procedures */

PROCEDURE WinExec EXTERNAL "kernel32.dll":
DEFINE INPUT PARAMETER ProgramName AS CHARACTER.
DEFINE INPUT PARAMETER Presentation AS LONG.
END PROCEDURE. /* WinExec2 */


PROCEDURE SHGetFolderPathA EXTERNAL "shfolder.dll":U :
DEFINE INPUT PARAMETER hwndOwner AS LONG.
DEFINE INPUT PARAMETER nFolder AS LONG.
DEFINE INPUT PARAMETER hToken AS LONG.
DEFINE INPUT PARAMETER dwFlags AS LONG.
DEFINE OUTPUT PARAMETER pszPath AS CHARACTER.
DEFINE RETURN PARAMETER hResult AS LONG.
END PROCEDURE.
 
Thank you but I found solution probably easier (for me of course).
Maybe somebody will use it.
I use OCX webbrowser and find method execWB.
For print it look like this:

def var c-p character.
chCtrlFrame:WebBrowser:execWB(6,0,"",INPUT-OUTPUT c-p).

Description these parametrs you can find on MS pages but for printing it is OK. Generally execWB is very nice method.
Sorry for my english.
Rafal
 
Back
Top