Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26770

    When using multiple source documents, the PD4ProgressListener fails to work. The document is rendered correctly, but the monitoring doesn’t.

    This is the progressUpdate method in my listener.
    <br /> public void progressUpdate(int mID, int prog, String notes, long ms) {<br /> if (DEBUG) Log.theLog.log("~~~~ %s%% Complete", prog);<br /> switch(mID) {<br /> case CONVERSION_BEGIN:<br /> if (DEBUG) Log.theLog.log("~~~~ Conversion Begin");<br /> break;<br /> case HTML_PARSED:<br /> if (DEBUG) Log.theLog.log("~~~~ HTML Parsed");<br /> break;<br /> case DOC_TREE_BUILT:<br /> if (DEBUG) Log.theLog.log("~~~~ Doc Tree Built");<br /> break;<br /> case HTML_LAYOUT_IN_PROGRESS:<br /> if (DEBUG) Log.theLog.log("~~~~ HTML Layout In Progress");<br /> break;<br /> case HTML_LAYOUT_DONE:<br /> if (DEBUG) Log.theLog.log("~~~~ HTML Layout Done");<br /> break;<br /> case TOC_GENERATED:<br /> if (DEBUG) Log.theLog.log("~~~~ TOC Generated");<br /> break;<br /> case DOC_OUTPUT_IN_PROGRESS:<br /> if (DEBUG) Log.theLog.log("~~~~ Doc Output In Progress");<br /> break;<br /> case NEW_SRC_DOC_BEGIN:<br /> if (DEBUG) Log.theLog.log("~~~~ New Src Doc Begin");<br /> break;<br /> case CONVERSION_END:<br /> if (DEBUG) Log.theLog.log("~~~~ Conversion End");<br /> break;<br /> }<br /> }<br />

    This is how I am calling it
    <br /> String html = "<span>Hello world</span>";<br /> StringReader sr = new StringReader(html);<br /> OutputStream os = new ByteArrayOutputStream();<br /> <br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.enableDebugInfo();<br /> pd4ml.useTTF( "java:", true );<br /> pd4ml.setHtmlWidth(1050);<br /> pd4ml.enableSmartTableBreaks(true);<br /> <br /> // ResumePrinterQueue.newListener() returns a vanilla PD4ProgressListener<br /> PD4ProgressListener prog = ResumePrinterQueue.newListener();<br /> pd4ml.monitorProgress(prog);<br /> <br /> try {<br /> //pd4ml.render(sr, os); //< <hr class="bbcode_rule" /> OK<br /> <br /> //pd4ml.render(sr, os, new java.net.URL(RTiClient.URL())); //< <hr class="bbcode_rule" /> OK<br /> <br /> StringReader[] arr = {sr};<br /> pd4ml.render(arr, os, new java.net.URL(RTiClient.URL())); //< <hr class="bbcode_rule" /> Fails<br /> } catch (Exception e) { }<br /> <br /> // Just something to make sure the compiler doesn't throw anything away<br /> Log.theLog.log(new String(((ByteArrayOutputStream)os).toByteArray()).substring(0, 8));<br />

    I’m using 3.80fx6 Volume, so I don’t think it is an issue of not having access to the methods. Is there some kind of config flag I am not setting, or is the monitoring broken for this instance?

    #29102

    Is there anything that can be done about this? We are trying to give the users some idea of progress (it can take 5-10 minutes to render, we don’t want them to think it has crashed or frozen).

    #29103

    I tested the feature with the most recent version – it works fine. Also I analyzed the relevant source code – there is no obvious reason to fail.

    I would recommend to start with a simpler monitor: temporarily remove if(DEBUG) conditions and replace Log.theLog.log with System.out.println

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.