/* STATUS: Broken. To compile, I installed debian's mozilla-dev, and then did this: g++ -I/usr/include/mozilla -I/usr/include/mozilla/nspr \ -I/usr/include/mozilla/xpcom -I/usr/include/mozilla/docshell \ -I/usr/include/mozilla/string -I/usr/include/mozilla/webbrwsr \ -I/usr/include/mozilla/widget -I/usr/include/mozilla/gfx \ -L/usr/lib/mozilla -lgtkembedmoz \ -o html2ps html2ps.cpp Then to run (since /usr/lib/mozilla isn't in the LD_LIBRARY_PATH by default) LD_LIBRARY_PATH=/usr/lib/mozilla ./html2ps */ // Good stuff to have #include #include #include // Gecko stuff #include #include #include #include #include #include #include //#include "nsIPrintSettings.h" int main(int argc, char** argv) { nsCOMPtr webBrowser; nsString mURI; mURI.AssignWithConversion("http://www.yahoo.com/"); webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID); printf("hello\n"); NS_InitEmbedding(nsnull, nsnull); printf("InitEmbedding done.\n"); nsCOMPtr nav(do_QueryInterface(webBrowser)); printf("Set up navigation.\n"); nav->LoadURI(mURI.get(),nsIWebNavigation::LOAD_FLAGS_NONE,nsnull,nsnull,nsnull); printf("Loaded yahoo. (?)\n"); nsCOMPtr print(do_QueryInterface(webBrowser)); printf("Got printer interface\n"); /* nsCOMPtr printSettings; printf("Created settings obj.\n"); print->GetGlobalPrintSettings(getter_AddRefs(printSettings)); printf("Got global settings.\n"); print->Print(printSettings,nsnull); */ print->Print(nsnull,nsnull); printf("Done printing.\n"); NS_TermEmbedding(); printf("TermEmbedding done.\n"); return 0; }