Class DocumentToMarkdownPageCompletedEventArgs
- Namespace
- LMKit.Document.Conversion
- Assembly
- LM-Kit.NET.dll
Provides data for the PageCompleted event.
public sealed class DocumentToMarkdownPageCompletedEventArgs : EventArgs
- Inheritance
-
DocumentToMarkdownPageCompletedEventArgs
- Inherited Members
Examples
Drive a progress bar and log per-page diagnostics.
using LMKit.Document.Conversion;
var converter = new DocumentToMarkdown();
converter.PageCompleted += (_, e) =>
{
if (e.Exception != null)
{
Console.WriteLine($"✗ Page {e.PageNumber}/{e.PageCount} failed: {e.Exception.Message}");
return;
}
var p = e.PageResult;
Console.WriteLine(
$"✓ Page {p.PageNumber}/{e.PageCount} [{p.StrategyUsed}] " +
$"{p.Elapsed.TotalMilliseconds:F0} ms, {p.GeneratedTokenCount} tokens");
};
Remarks
Raised after each page has been processed, regardless of whether the conversion succeeded or failed. Inspect Exception to detect failures and PageResult to access the generated Markdown and diagnostics.
Properties
- Exception
Gets the exception thrown while processing this page, or
nullwhen the page was processed successfully. An operation-canceled exception is forwarded to the caller and is not reported through this property.
- PageCount
Gets the total number of pages scheduled for the current conversion.
- PageIndex
Gets the zero-based index of the page that has just been processed.
- PageNumber
Gets the 1-based page number, convenient for user-facing output.
- PageResult
Gets the per-page result produced by the converter, or
nullif the conversion failed for this page.
- SourceName
Gets the logical name of the source document, when available.