boardtc
asked on
Print html document (C++Builder)
I know I am technically in the wrong group but there does not seem to be any C++Builder experts in the C++ Programming forum. Coming from a Delphi background to C++Builder very recently I think some Delphi experts may be able to help me.
I want to print a html document which the user does not have to see. In C++Builder 5.01 there is a component TCppWebBrowser that has a method ExecWB which makes it possible to print but I have having problems with it. I believe in Delphi the equivalent component is TWebBrowser.
Can anyone offer me any advice? If there are experts out there who can help I can provide mre information if required.
Thanks a lot,
Tom.
I want to print a html document which the user does not have to see. In C++Builder 5.01 there is a component TCppWebBrowser that has a method ExecWB which makes it possible to print but I have having problems with it. I believe in Delphi the equivalent component is TWebBrowser.
Can anyone offer me any advice? If there are experts out there who can help I can provide mre information if required.
Thanks a lot,
Tom.
ASKER
Thanks a lot for the answer. The above is the code I have been having the problem with. If I run the above ot works. The problem is I want to run it all together, if I call the above OnClick events or the below in a single procedure it does not work but will work if the 2 steps are executed under seperate buttons. Put them under one or call the second OnClick from the first and it doesn't work! Am I going crazy?! Both steps work on their own without vIn or vOut too.
TVariant vIn;
TVariant vOut;
CppWebBrowser1->Navigate(W ideString( sHTMLFile) ,&vIn,&vOu t);
CppWebBrowser1->ExecWB(Shd ocvw_tlb:: OLECMDID_P RINT,
Shdocvw_tlb::OLECMDEXECOPT _DONTPROMP TUSER,&vIn ,&vOut);
Does it work under one button for you?
Cheers, Tom.
TVariant vIn;
TVariant vOut;
CppWebBrowser1->Navigate(W
CppWebBrowser1->ExecWB(Shd
Shdocvw_tlb::OLECMDEXECOPT
Does it work under one button for you?
Cheers, Tom.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your comment lead to my solution, thank you! TcppWebBrowser has a OnDocumentComplete event which is where I moved the ExecWB printing command.
Cheers, Tom.
Cheers, Tom.
this works ok in builder4:
void __fastcall TForm1::Button1Click(TObje
{
TVariant i,o;
WebBrowser1->Navigate(Wide
}
//------------------------
void __fastcall TForm1::Button2Click(TObje
{
TVariant i,o;
WebBrowser1->ExecWB(Shdocv
}
set teh visible property of the browser to false if you dont want user to see it,and use the OLECMDEXECOPT_DONTPROMPTUS
Regards Barry