Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCppWebBrowser : printing but not viewing

Status
Not open for further replies.

tomcorcoran

Programmer
Jun 14, 2001
5
US
not sure about the difference between the 2 forums, this was unanswered in the other...

My goal is to print a html document in C++Builder 5.01 without the user previewing the document, ie.
the html file is not shown to the user. I can print the document successfully by first loading the html
file with TCppWebBrowser.Navigate and then calling ExecWB in the
OnDocumentComplete event. I see 2 solutions (below), neither of which I can get to work, I would prefer
the second option or maybe someone can suggest another way.

1. make the TCppWebBrowser invisible
2. create TCppWebBrowser dynamically, attaching an OnDownloadComplete event where the printing is done

1. I have tried setting TCppWebBrowser1->Visible = False in the object inspector, in OnPaint and under
a button without success. It still remains Visible?

2. I create TCppWebBrowser dynamically as follows

void __fastcall TMainForm::FormPaint(TObject *Sender)
{
// why in OnPaint?
// the form must be visible prior to the creation of
// the WebBrowser
if (!oHTML)
{
oHTML = new TCppWebBrowser(this);
oHTML->OnDocumentComplete = DocumentComplete;
}
}

I navigate to the document and after waiting a while to make sure it is loaded I call ExecWB to print
it (the same code which prints in 1). However that does not work. Also the OnDocumentComplete event,
DocumentComplete, never gets called.

Can anyone provide some insight?

Thanks very much,

Tom.
 
I put a panel underneath the TCppWebBrowser and get this it prints fine when the panel is visible and doesn't print when the panel is invisible! There has to be a workaround.
Sounds like no one has experience with it though.

Cheers, Tom.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top