Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, February 16, 2018 12:11:38 PM(UTC)

Walter  
Walter

Groups: Tech Support, Administrators
Posts: 368

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

The Document Writer has a progress event that allows a developer to monitor the progress of document writer operations as well as cancel the operation if necessary.

When converting an LTD file to a desired output file, the percentage values occilate bewtween 0 & 100 multiple times. This is because the Document Writers are firing the progress event while going through each operation.

The following code illustrates each operation so you as the developer will know where the Document Writer is in the conversion & can indicate to the user with a progress bar & label what is happening.
Code:

int progressCounter = 0;
int progressPageNumber = 1;
docWriter.Progress += (sender, e) =>
{
   if(progressCounter == 0) //Begin Document
   {
      Console.Write("\rBegin Document: {0}%", e.Percentage);
   }
   else if(progressCounter <= NUMBER_DOCUMENT_PAGES)  //Processing page
   {
      Console.Write("\rProcessing Page #{0}: {1}%", progressPageNumber, e.Percentage);

      if (e.Percentage == 100)
         progressPageNumber++;
   }
   else if(progressCounter == (NUMBER_DOCUMENT_PAGES + 1)) //End document
   {
      Console.Write("\rFinalizing document - {0}%", e.Percentage);
   }

   if (e.Percentage == 100)
   { 
      progressCounter++;
      Console.WriteLine("");
   }

};


This code will generate output like this:
Begin Document: 100%
Processing Page #1: 100%
Processing Page #2: 100%
Processing Page #3: 100%
Processing Page #4: 100%
Processing Page #5: 100%
Finalizing document - 100%
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.067 seconds.