I trying to save DOM Document from my embedded java application.

saveDocument works well for document without images.But
PersistProgressListener remains in PERSIST_STATE_READY all the time if
the document has any images.Not sure if Iam missing something.

I am unable to proceed.Iam using xulrunner1.8.1.3 version.

Thanks in Advance,
Krithika


// code snippet
                        File file = new File(filename);
                        String path=file.getParent();
                        nsILocalFile localPath =
(nsILocalFile)factory.componentManager.createInstanceByContractID("@mozilla.org/
file/local;1",null,nsILocalFile.NS_ILOCALFILE_IID);
                        nsILocalFile localFile =
(nsILocalFile)factory.componentManager.createInstanceByContractID("@mozilla.org/
file/local;1",null,nsILocalFile.NS_ILOCALFILE_IID);
                        localFile.initWithPath(filename);
                        localPath.initWithPath(path);

                        persist =
(nsIWebBrowserPersist)factory.componentManager.createInstanceByContractID("@mozilla.org/
embedding/browser/nsWebBrowserPersist;
1",null,nsIWebBrowserPersist.NS_IWEBBROWSERPERSIST_IID);

                        PersistProgressListener persistListener = new
PersistProgressListener(persist);
                        persist.setProgressListener(persistListener);

                        
persist.saveDocument(doc,localFile,localPath,null,flags,0);
                        while(persist.getCurrentState() !=
nsIWebBrowserPersist.PERSIST_STATE_FINISHED)
                        {
                               System.out.println("Saving in progress.
State: "+persist.getCurrentState());
                                try
                                {
                                        Thread.sleep(100);
                                }catch(Exception e){}

                        }

                        System.out.println("DOCUMENT  Save Complete "+filename);

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to