SetDocumentPrinter method

Modifies the device context to ensure that IHTMLElementRender::DrawToDC works properly on all printers.

Syntax

HRESULT retVal = object.SetDocumentPrinter(bstrPrinterName, hDC);

Parameters

  • bstrPrinterName [in]
    Type: BSTR

    A BSTR containing the printer name.

  • hDC [in]
    Type: HDC

    An HDC for the printer specified by bstrPrinterName. After this method returns, pass hDC to IHTMLElementRender::DrawToDC to draw to the printer.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

With some printers, running IHTMLElementRender::DrawToDC may cause problems. Running this method modifies the device context to ensure that IHTMLElementRender::DrawToDC works properly on all printers.