tomcorcoran
Programmer
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.
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.