HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › Progress Monitor/Feedback mechanism during PDF generation
- This topic has 5 replies, 3 voices, and was last updated Nov 17, 2011
14:20:57 by brhodes.
-
AuthorPosts
-
October 4, 2011 at 17:10#26613
I am looking for a way that I can provide some progress feedback to my users about the state of the HTML/PDF conversion. I don’t see anything within the Java API that would allow me to register any sort of conversion status callback.
Is there a way that people are providing feedback to their clients? I’m using the Java API within an app and not in a web server environment.
Thanks,
ThomasOctober 5, 2011 at 13:03#28682Currently PD4ML offers no such API.
We are ready to implement it by request – please contact support pd4ml com
November 15, 2011 at 22:25#28683I noticed the new 3.8.0 version allows for progress monitoring. Is there a simple example somewhere of how to use the API for this feature?
November 16, 2011 at 14:44#28684Sorry, we still not updated the documentation.
The code below implements a simple dump of progress messages. Just combine the approach with your progress meter component state update.
The current implementation probably still needs some balance refining between HTML parding, layouting and PDF output phases. However on our test scenarios the progress indication looks more-less smooth.
[language=java:1e45c9tp]pd4ml.monitorProgress(new ProgressMeter());
…
public class ProgressMeter implements PD4ProgressListener {public void progressUpdate(int messageID, int progress, String note, long msec) {
String tick = String.format( “%7d”, msec );
String progressString = String.format( “%3d”, progress );String step = “”;
switch ( messageID ) {
case CONVERSION_BEGIN:
step = “conversion begin”;
break;
case HTML_PARSED:
step = “html parsed”;
break;
case DOC_TREE_BUILT:
step = “document tree structure built”;
break;
case HTML_LAYOUT_IN_PROGRESS:
step = “layouting…”;
break;
case HTML_LAYOUT_DONE:
step = “layout done”;
break;
case TOC_GENERATED:
step = “TOC generated”;
break;
case DOC_OUTPUT_IN_PROGRESS:
step = “generating PDF…”;
break;
case NEW_SRC_DOC_BEGIN:
step = “proceed to new source document”;
break;
case CONVERSION_END:
step = “done.”;
break;
}System.out.println( tick + ” ” + progressString + ” ” + step + ” ” + note );
}
}[/language:1e45c9tp]November 17, 2011 at 05:17#28685Many thanks… I will check it out.
November 17, 2011 at 14:20#28686Am I mistaken or does the current downloadable version of pd4ml.pro.trial.380.zip not include the new PD4ProgressListener interface? I have included a screenshot of the jar file dir “org/zefer/pd4ml”. The API documentation seems to be correct in the zip file though
Also, the API on the website (http://pd4ml.com/api/index.html) uses an older version and makes no mention of the PD4ProgressListener interface.
Thanks,
Burton -
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.