On Mar 5, 11:52 am, "krithika" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have embedded Gecko engine , successfully loaded and obtained the
> Document.But My goal is to get the page count of the loaded document.
>
> getPrintPreviewNumPages() throws exception as shown
>
> Exception in thread "Thread-3" org.mozilla.xpcom.XPCOMException: The
> function "printPre
> viewNumPages" returned an error condition (0x80004005)
> at
> org.mozilla.xpcom.internal.XPCOMJavaProxy.callXPCOMMethod(Native
> Method)
> at
> org.mozilla.xpcom.internal.XPCOMJavaProxy.invoke(XPCOMJavaProxy.java:
> 140)
> at $Proxy11.getPrintPreviewNumPages(Unknown Source)
> at DocumentProcessor.run(DocumentProcessor.java:132)
> at java.lang.Thread.run(Unknown Source)
>
> My code is as shown.What am I missing?
>
> stuck in this for past few days.
>
> I also tried with proxy object for print but same exception.
>
> nsIWebBrowserPrint printProxy =
> (nsIWebBrowserPrint)proxy.getProxyForObject(eventQueue,nsIWebBrowserPrint.NS_IWEBBROWSERPRINT_IID,
> renderer.print,nsIProxyObjectManager.INVOKE_SYNC);
>
> regards,
> Krith
>
> nsIWebBrowser browserProxy =
> (nsIWebBrowser)proxy.getProxyForObject(eventQueue,nsIWebBrowser.NS_IWEBBROWSER_IID,renderer.browser,nsIProxyObjectManager.INVOKE_SYNC);
> nsIWebNavigation webNavigationProxy =
> (nsIWebNavigation)renderer.proxy.getProxyForObject(eventQueue,nsIWebNavigation.NS_IWEBNAVIGATION_IID,renderer.webNavigation,nsIProxyObjectManager.INVOKE_SYNC);
> System.out.println("Step4: nsIWebNavigation "+webNavigationProxy);
> doc = webNavigationProxy.getDocument();
>
> nsIDOMWindow domwindow = browserProxy.getContentDOMWindow();
> System.out.println("Step5: nsIDOMWindow "+domwindow);
> processDocument(doc);
>
> nsIInterfaceRequestor ir = (nsIInterfaceRequestor)
> browserProxy.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID);
> nsIWebBrowserPrint print = (nsIWebBrowserPrint)
> ir.getInterface(nsIWebBrowserPrint.NS_IWEBBROWSERPRINT_IID);
>
> nsIPrintSettings settings=print.getGlobalPrintSettings();
> System.out.println("Step7: printSettings "+settings);
> print.printPreview(settings,null,null);
> int count=printProxy.getPrintPreviewNumPages();
Resolved after I set settings.setShowPrintProgress(false);
Krith
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding