Save web page to PDF using Mozilla.Browser ActiveX

MarkusW <[email protected]>
Newsgroups gmane.comp.mozilla.devel.embedding
Organization http://groups.google.com
Message-ID <0dce4228-566f-4543-8675-01926f37eba9@v23g2000vbi.googlegroups.com>
Essentially I'd like to do what the PrintPDF AddOn for Firefox does
(call the gecko engine to save the current web page as PDF). But I'd
like to do it programmatically from my Win32 app.

The code below is javascript from the PrintPDF AddOn. How to do this
with the ActiveX?

TIA,

Markus


    var webBrowserPrint =
window.content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
    .getInterface(Components.interfaces.nsIWebBrowserPrint);

    var PSSVC = Components.classes["@mozilla.org/gfx/printsettings-
service;1"]
    .getService(Components.interfaces.nsIPrintSettingsService);

    var printSettings = PSSVC.newPrintSettings;

    printSettings.printToFile = true;
    printSettings.toFileName  = picker.file.path;
    printSettings.printSilent = true;
    printSettings.outputFormat =
Components.interfaces.nsIPrintSettings.kOutputFormatPDF;

    webBrowserPrint.print(printSettings, null);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.