HTML to PDF converter for Java and .NET

HOME   FEATURES   PRODUCTS   DOWNLOADS   BUY NOW!   SUPPORT
<< back

PD4ML: PDF Output Progress Monitoring

 

Since version 3.80 PD4ML can provide conversion progress information. Below is an example, which dumps all progress update messages to STDOUT. In real-life usage scenarios you would probably prefer to pass int progress parameter value to a progress bar GUI component etc. The value range is from 0 to 100.

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 );
		
	}
}
Copyright ©2004-17 zefer|org. All rights reserved. Bookmark and Share