Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Печать вебстраниц в TWebBrowser [D5, D7, WinXP]


Bohdan ©   (2004-07-21 20:50:00) 

Уважаемые мастера! Помогите кто знает, как распечатать документ, загруженный в компонент TWebBrowser!


Rouse_   (2004-07-23 15:20:00) [1]

ОФФ:
> [4] Romkin ©   (23.07.04 14:57)
А чем тебе "хендехох" не нравится?
Тем более там комментарий как на немецком так и по русски на английстком написано :)

> [6] Vitaly ©   (23.07.04 15:11)
Ссылки приводятся на код а не на описание кода...


Vitaly   (2004-07-23 15:11:00) [2]

А по-русски слабо?
http://www.compress.ru/Temp/1127/index.htm


Bohdan   (2004-07-23 15:07:00) [3]

Огромное СПАСИБО Вам, друзья!!!


Romkin   (2004-07-23 14:57:00) [4]

Rouse_ ©  (23.07.04 14:54) [3] Ну что тебя все на немецкий тянет?
http://members.shaw.ca/iedelphi/webbrowser.htm#advanced1


Rouse_   (2004-07-23 14:54:00) [5]

http://www.swissdelphicenter.ch/en/showcode.php?id=478


Bohdan   (2004-07-23 14:50:00) [6]

Уважаемые программеры! Так неужели ни у кого нет никаких мыслей по этому поводу???


Bohdan   (2004-07-22 18:04:00) [7]

Господа, неужели никто не сталкивался с такой (достойной ламера) задачей. Вот выкладываю всю докуменацию, исходники от МicroSoft на C++, только не знаю как перевести под Delphi

---------------------------------------------
Printing Pages with the WebBrowser Control

Although the WebBrowser control does not support a print method, you can print its contents using one of the following methods:

Set the focus to the WebBrowser control and send a key combination of CTRL+P.
Call the IWebBrowser2::get_Document method, which returns an IDispatch pointer. Using this IDispatch pointer, call QueryInterface on IID_IOleCommandTarget. With the object pointer returned, call IOleCommandTarget::Exec (NULL, OLECMDID_PRINT, 0, NULL, NULL).
LPDISPATCH lpDispatch = NULL;
LPOLECOMMANDTARGET lpOleCommandTarget = NULL;

lpDispatch = m_pBrowser.get_Document();
ASSERT(lpDispatch);

lpDispatch->QueryInterface(IID_IOleCommandTarget, (void**)&lpOleCommandTarget);
ASSERT(lpOleCommandTarget);

lpDispatch->Release();

// Print contents of WebBrowser control.
lpOleCommandTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL,NULL);
lpOleCommandTarget->Release();
----------------------------------------------------------------------------------------------------------------
Changing Fonts with the WebBrowser Control
The WebBrowser automation model does not support a method that allows you to change the font of the text of the currently displayed page. However, the WebBrowser control exposes this functionality through the IOleCommandTarget interface. Call the IWebBrowser2::get_Document method, which returns an IDispatch pointer. Using this IDispatch pointer, call QueryInterface on IID_IOleCommandTarget. With this IOleCommandTarget interface pointer, call IOleCommandTarget::Exec with OLECMDID_ZOOM and use the pvaIn input argument to pass a value in the range of 0 to 5 (where 0 is smallest), indicating the desired scale of the font. This, in effect, mimics the functionality available through the Internet Explorer Fonts command on the View menu.

Hide Example

LPDISPATCH pDisp = NULL;
LPOLECOMMANDTARGET pCmdTarg = NULL;

pDisp = m_pBrowser.get_Document();
ASSERT(pDisp);

pDisp->QueryInterface(IID_IOleCommandTarget, (LPVOID*)&pCmdTarg);
ASSERT(pCmdTarg);

VARIANT vaZoomFactor;   // input arguments
VariantInit(&vaZoomFactor);
V_VT(&vaZoomFactor) = VT_I4;
V_I4(&vaZoomFactor) = fontSize;

pCmdTarg->Exec(NULL,
 OLECMDID_ZOOM,
 OLECMDEXECOPT_DONTPROMPTUSER,
 &vaZoomFactor,
 NULL);
VariantClear(&vaZoomFactor);

if (pCmdTarg)
  pCmdTarg->Release(); // release document's command target
if (pDisp)
  pDisp->Release();    // release document's dispatch interface
--------------------------------------


Наверх

Титульная страница Поиск, карта сайта Написать письмо