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.

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

    This is how I am calling it

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

    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.