[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mozilla-layout
Subject:    Images lost during 'Print as PDF'
From:       sarv <saravanan.sengamalan () gmail ! com>
Date:       2009-08-13 5:29:21
Message-ID: 105e31f8-ee48-4f7a-a800-2cf50b7b21c8 () r38g2000yqn ! googlegroups ! com
[Download RAW message or body]

Hello,
I am using Java Embedding APIs of XULRUNNER 1.9 to save a loaded HTML
file to a PDF file (print as PDF). The problem is that few of my
images (random every time) disappear in my PDF. It looks as though
the PDF is written even before all the images are loaded completely on
the window.
I am not sure if the method I am using to check the end of loading
is correct or am I missing anything in all.js? (i use
network.http.pipelining=false)

Here is my code:
....
webNavProxy.loadURI (urlToLoad,
nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE,
                                  null, null, null);    // where
webNavProxy is a proxy object of nsIWebNavigation
while(!loadingComplete){
   // sleep for 1 sec
}

.....
and ..
public class WebProgressListener implements
nsIWebProgressListener,nsISupports
{
....
         public void onStateChange(nsIWebProgress wp, nsIRequest req,
long sflag, long status)
         {
                boolean isLoading = wp.getIsLoadingDocument();
                boolean isDocument = (sflag &
nsIWebProgressListener.STATE_IS_DOCUMENT) != 0;
                boolean start = (sflag &
nsIWebProgressListener.STATE_START) !=0;
                boolean stop = (sflag &
nsIWebProgressListener.STATE_STOP) !=0;
                if((!isLoading) && (!start) && (!isDocument) && stop)
{
                          loadingComplete = true;
                          ... //process the loaded document and print
as pdf
                }
         }
}

Please help.
Thanks in advance.
-Saravanan-
_______________________________________________
dev-tech-layout mailing list
dev-tech-layout@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-layout
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic