Reporting progress during PDF creation

Ibex supports the use of a callback mechanism to report progress during PDF creation.

To use the callback mechanism, create a class which implements the ibex4.IProgressCallback interface, which is defined as:

public interface IProgressCallback {
  void Report( float percentage_complete );
}
      

The interface supports a single method which is passed a float value. This value is the percentage complete, ranging from 0.0 to 100.0.

A class should be defined which implements this interface, like this:

public class ProgressReporter : ibex4.IProgressCallback {

  public void Report( float percent_complete ) {

      Console.WriteLine( "progress callback: " + Math.Round( percent_complete, 0 ) + "%" );

  }
}
      

Once the class has been defined, an instance of that class should be passed to the FODocument object like this:

FODocument doc = new FODocument();

doc.setProgressCallback( new ProgressReporter() );

doc.generate( .. )
      

The Report method on the object will be called periodically as the PDF file is created. It is only called when the percent completed is at least 1% more than when it was last called, so it will be called a maximum of 100 times for a single document. It is also called at most once every 10 pages, so for documents with less than 10 pages it will not be called.

For small documents (less than 50 pages) the results will not typically be very useful as document creation is so fast.

Copyright (c) 2002-2016 Visual Programming Limited