Henara.Scan.Client 1.4.0
Henara.Scan.Client
Setup
dotnet add package Henara.Scan.Client
builder.Services.AddScanClient(builder.Configuration);
| Variable | Required | Default |
|---|---|---|
SCAN_SERVICE_URL |
yes | — |
SCAN_API_TOKEN |
yes | — |
SCAN_DEADLINE_SECONDS |
no | 300 |
SCAN_MAX_MESSAGE_BYTES |
no | 67108864 |
Results
if ((await scan.Crop(image, cancellationToken)).TryGetValue(out var page, out var error) == false)
return error;
var city = front.PatientCity.Or("unknown");
if (front.PatientBirthDate.TryGetValue(out var born))
Use(born);
Calls
Leave IsAutocropEnabled off for images that are already cropped.
var cropped = await scan.Crop(image, cancellationToken);
var pdf = await scan.Combine([front, back], isAutocropEnabled: true, cancellationToken);
Muster 13 and Muster 56
var reading = await scan.ReadMuster13(
new SheetsReadRequest(
[
new SheetImage(SheetSide.Front, front, IsAutocropEnabled: true),
new SheetImage(SheetSide.Back, back)
],
IsFieldImageRequested: true,
new ReadOutputs(RenderTargets.Pdf | RenderTargets.Html, false, false)),
PrescriptionStage.Issue,
cancellationToken);
ReadMuster56 takes the same request without a stage. A PDF of one or two pages goes in a single
SheetImage, with IsFieldImageRequested: false.
Field, option and fact names follow the ids of henara-vo-preview's data/; Label() gives each its
wording there. Obligations names the mandatory fields left empty for the stage asked for.
Front page with either engine
var frontPage = await scan.ReadMuster13FrontPage(
OcrEngine.Azure,
new FrontPageReadRequest(front, new ReadOutputs(RenderTargets.None, false, false)),
PrescriptionStage.Issue,
cancellationToken);
Fields holds what both engines read; with Mistral, Mistral holds every field of the front page and
Obligations how it meets them.
Teilnahmebestätigung
var attendance = await scan.ReadAttendanceSheet(
new AttendanceSheetReadRequest(sheet, IsAutocropEnabled: true),
cancellationToken);
Own schema
var schemas = await scan.ListSchemas(cancellationToken);
var custom = await scan.ReadMuster13(
new SheetsReadRequest([new SheetImage(SheetSide.Front, front)], false, new ReadOutputs())
{
SchemaJson = schemaJson
},
PrescriptionStage.Issue,
cancellationToken);
var annotation = await scan.ReadImagesWithSchemaWithMistral(
new SchemaReadRequest(schemaJson, [page1, page2]),
cancellationToken);
Batches
Inject IScanBatchClient. Each instance is one client: it sees only the batches, jobs and events it
created. Options apply to every item; each item is answered once it is stored.
await foreach (var receipt in batches.Submit(
new BatchOptions(new ReadOutputs(RenderTargets.Pdf, false, false)),
items,
cancellationToken))
{
if (receipt.TryGetValue(out var answer, out var error) == false)
return error;
}
A Muster 56 item with Teilnahmebestätigungen produces two jobs; all of its up to 10 sheets are one job. Every job names its files by the ids the service gave them.
var item = new Muster56Item(
"vo-17",
new PageImage(front, IsAutocropEnabled: true),
Option<PageImage>.None,
[new PageImage(attendanceSheet1), new PageImage(attendanceSheet2)]);
One event stream per client; a second Subscribe ends the first. Unacknowledged events come again on the
next subscription.
await using var subscription = batches.Subscribe(cancellationToken);
await foreach (var next in subscription.Events)
{
if (next.TryGetValue(out var jobEvent, out var error) == false)
break;
Handle(jobEvent);
subscription.Acknowledge(jobEvent);
}
var selection = new JobSelection([batchId], []);
var status = await batches.GetStatus(selection, cancellationToken);
await foreach (var result in batches.StreamResults(selection, isOriginalFileRequested: true, cancellationToken))
Use(result);
var restarted = await batches.Restart(selection, cancellationToken);
Field images
var stamp = reading.Reading.FieldImages.FirstOrDefault(image => image.FieldId == "stempel-arzt");
if (stamp is { HasInk: true })
Save(stamp.Content, stamp.ContentType);
FieldId |
Form | Sheet |
|---|---|---|
stempel-arzt |
Muster 13 | front |
stempel-leistungserbringer |
Muster 13 | back |
leistung-unterschrift-1 … -20 |
Muster 13 | back |
stempel-arzt |
Muster 56 | back |
unterschrift-versicherter |
Muster 56 | back |
stempel-kk |
Muster 56 | back |
No packages depend on Henara.Scan.Client.
.NET 10.0
- Google.Protobuf (>= 3.36.2)
- Grpc.Net.ClientFactory (>= 2.85.0)
- Henara.Scan.Contracts (>= 1.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.14)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.14)
| Version | Downloads | Last updated |
|---|---|---|
| 1.4.0 | 19 | 11/03/2026 |
| 1.3.0 | 2 | 10/31/2026 |
| 1.2.0 | 2 | 10/30/2026 |
| 1.1.0 | 0 | 10/30/2026 |
| 1.0.0 | 1 | 10/30/2026 |
| 0.14.0 | 7 | 10/16/2026 |
| 0.13.0 | 20 | 10/08/2026 |
| 0.12.0 | 4 | 10/07/2026 |
| 0.11.0 | 16 | 09/28/2026 |
| 0.10.0 | 5 | 09/06/2026 |
| 0.9.0 | 3 | 09/06/2026 |
| 0.8.0 | 13 | 09/05/2026 |
| 0.7.0 | 10 | 09/05/2026 |
| 0.6.0 | 33 | 08/29/2026 |
| 0.5.0 | 7 | 08/29/2026 |
| 0.4.0 | 1 | 08/28/2026 |
| 0.3.0 | 14 | 08/26/2026 |
| 0.2.0 | 1 | 08/26/2026 |