Refactor: Standardize method names across clients
Renamed methods across multiple client classes for consistency, shortening and aligning naming conventions (e.g., `CheckAttachmentsAsync` → `CheckAsync`, `ValidatePdfAsync` → `ValidateAsync`). Updated corresponding interfaces, unit tests, and documentation to reflect the new method names. Standardized method signatures to support both `Stream` and `byte[]` overloads consistently. Improved error handling in tests and updated examples in the README for batch processing and validation scenarios. Enhanced API endpoint overview for clarity.
This commit is contained in:
@@ -194,17 +194,17 @@ using DocumentService.Client;
|
||||
|
||||
// Variante A: byte[]
|
||||
byte[] pdfBytes = await File.ReadAllBytesAsync("rechnung.pdf");
|
||||
var result = await Client.Workflows.ExtractSwissQrCodeValidatedAsync(pdfBytes);
|
||||
var result = await Client.Workflows.ExtractAsync(pdfBytes);
|
||||
|
||||
Console.WriteLine($"Betrag: {result?.Bill?.Amount} {result?.Bill?.Currency}");
|
||||
Console.WriteLine($"Empfänger: {result?.Bill?.Creditor?.Name}");
|
||||
|
||||
// Variante B: Stream
|
||||
using var stream = File.OpenRead("rechnung.pdf");
|
||||
var result2 = await Client.Workflows.ExtractSwissQrCodeValidatedAsync(stream);
|
||||
var result2 = await Client.Workflows.ExtractAsync(stream);
|
||||
|
||||
// Variante C: Dateipfad
|
||||
var result3 = await Client.Workflows.ExtractSwissQrCodeValidatedAsync("rechnung.pdf");
|
||||
var result3 = await Client.Workflows.ExtractAsync("rechnung.pdf");
|
||||
```
|
||||
|
||||
```vbnet
|
||||
@@ -212,13 +212,13 @@ Imports DocumentService.Client
|
||||
|
||||
' Variante A: byte[]
|
||||
Dim pdfBytes = System.IO.File.ReadAllBytes("rechnung.pdf")
|
||||
Dim result = Await Client.Workflows.ExtractSwissQrCodeValidatedAsync(pdfBytes)
|
||||
Dim result = Await Client.Workflows.ExtractAsync(pdfBytes)
|
||||
|
||||
Console.WriteLine($"Betrag: {result?.Bill?.Amount} {result?.Bill?.Currency}")
|
||||
Console.WriteLine($"Empfänger: {result?.Bill?.Creditor?.Name}")
|
||||
|
||||
' Variante B: Dateipfad
|
||||
Dim result2 = Await Client.Workflows.ExtractSwissQrCodeValidatedAsync("rechnung.pdf")
|
||||
Dim result2 = Await Client.Workflows.ExtractAsync("rechnung.pdf")
|
||||
```
|
||||
|
||||
```powershell
|
||||
@@ -226,12 +226,12 @@ Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
# Variante A: byte[]
|
||||
$pdfBytes = [System.IO.File]::ReadAllBytes("rechnung.pdf")
|
||||
$result = [DocumentService.Client.Client]::Workflows.ExtractSwissQrCodeValidatedAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::Workflows.ExtractAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
Write-Host "Betrag: $($result.Bill.Amount) $($result.Bill.Currency)"
|
||||
Write-Host "Empfaenger:$($result.Bill.Creditor.Name)"
|
||||
|
||||
# Variante B: Dateipfad
|
||||
$result2 = [DocumentService.Client.Client]::Workflows.ExtractSwissQrCodeValidatedAsync("rechnung.pdf").GetAwaiter().GetResult()
|
||||
$result2 = [DocumentService.Client.Client]::Workflows.ExtractAsync("rechnung.pdf").GetAwaiter().GetResult()
|
||||
```
|
||||
|
||||
**Fehlerbehandlung – `throwIfInvalid`:**
|
||||
@@ -240,10 +240,10 @@ Standardmäßig wirft die Methode eine `InvalidOperationException`, wenn das PDF
|
||||
|
||||
```csharp
|
||||
// Exception (Standard) – geeignet, wenn ungültige PDFs ein Fehlerfall sind
|
||||
var result = await Client.Workflows.ExtractSwissQrCodeValidatedAsync(pdfBytes);
|
||||
var result = await Client.Workflows.ExtractAsync(pdfBytes);
|
||||
|
||||
// Null zurückgeben – geeignet für Batch-Verarbeitung o. Ä.
|
||||
var result = await Client.Workflows.ExtractSwissQrCodeValidatedAsync(pdfBytes, throwIfInvalid: false);
|
||||
var result = await Client.Workflows.ExtractAsync(pdfBytes, throwIfInvalid: false);
|
||||
if (result is null)
|
||||
{
|
||||
Console.WriteLine("Dokument ungültig oder verschlüsselt – übersprungen.");
|
||||
@@ -252,10 +252,10 @@ if (result is null)
|
||||
|
||||
```vbnet
|
||||
' Exception (Standard)
|
||||
Dim result = Await Client.Workflows.ExtractSwissQrCodeValidatedAsync(pdfBytes)
|
||||
Dim result = Await Client.Workflows.ExtractAsync(pdfBytes)
|
||||
|
||||
' Null zurückgeben
|
||||
Dim result2 = Await Client.Workflows.ExtractSwissQrCodeValidatedAsync(pdfBytes, throwIfInvalid:=False)
|
||||
Dim result2 = Await Client.Workflows.ExtractAsync(pdfBytes, throwIfInvalid:=False)
|
||||
If result2 Is Nothing Then
|
||||
Console.WriteLine("Dokument ungültig oder verschlüsselt – übersprungen.")
|
||||
End If
|
||||
@@ -263,16 +263,16 @@ End If
|
||||
|
||||
```powershell
|
||||
# Exception (Standard)
|
||||
$result = [DocumentService.Client.Client]::Workflows.ExtractSwissQrCodeValidatedAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::Workflows.ExtractAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
|
||||
# Null zurückgeben ($false = throwIfInvalid:false)
|
||||
$result2 = [DocumentService.Client.Client]::Workflows.ExtractSwissQrCodeValidatedAsync($pdfBytes, $false, $false).GetAwaiter().GetResult()
|
||||
$result2 = [DocumentService.Client.Client]::Workflows.ExtractAsync($pdfBytes, $false, $false).GetAwaiter().GetResult()
|
||||
if ($null -eq $result2) {
|
||||
Write-Host "Dokument ungueltig oder verschluesselt – uebersprungen."
|
||||
}
|
||||
```
|
||||
|
||||
> **Signatur:** `ExtractSwissQrCodeValidatedAsync(pdfBytes / Stream / filePath, raw = false, throwIfInvalid = true, ct = default)`
|
||||
> **Signatur:** `ExtractSwissQrCodeAsync(pdfBytes / Stream / filePath, raw = false, throwIfInvalid = true, ct = default)`
|
||||
> `raw: true` liefert die Rohtextzeilen des QR-Codes ohne Parsing zurück (siehe [Schweizer QR-Code-Extraktion](#4-schweizer-qr-code-extraktion)).
|
||||
|
||||
---
|
||||
@@ -284,7 +284,7 @@ using DocumentService.Client;
|
||||
|
||||
// Variante A: Stream (multipart/form-data – empfohlen für große Dateien)
|
||||
using var stream = File.OpenRead("rechnung.pdf");
|
||||
var result = await Client.Validation.ValidatePdfAsync(stream);
|
||||
var result = await Client.Validation.ValidateAsync(stream);
|
||||
|
||||
Console.WriteLine($"Seiten: {result.PageCount}");
|
||||
Console.WriteLine($"PDF-Version: {result.PdfVersion}");
|
||||
@@ -294,7 +294,7 @@ Console.WriteLine($"Dateigröße: {result.FileSizeMB:F2} MB");
|
||||
|
||||
// Variante B: byte[] (Base64 JSON)
|
||||
byte[] pdfBytes = await File.ReadAllBytesAsync("rechnung.pdf");
|
||||
var result2 = await Client.Validation.ValidatePdfAsync(pdfBytes);
|
||||
var result2 = await Client.Validation.ValidateAsync(pdfBytes);
|
||||
```
|
||||
|
||||
```vbnet
|
||||
@@ -302,7 +302,7 @@ Imports DocumentService.Client
|
||||
|
||||
' Variante A: Stream
|
||||
Dim stream As New System.IO.FileStream("rechnung.pdf", System.IO.FileMode.Open)
|
||||
Dim result = Await Client.Validation.ValidatePdfAsync(stream)
|
||||
Dim result = Await Client.Validation.ValidateAsync(stream)
|
||||
stream.Dispose()
|
||||
|
||||
Console.WriteLine($"Seiten: {result.PageCount}")
|
||||
@@ -313,7 +313,7 @@ Console.WriteLine($"Dateigröße: {result.FileSizeMB:F2} MB")
|
||||
|
||||
' Variante B: byte[]
|
||||
Dim pdfBytes = System.IO.File.ReadAllBytes("rechnung.pdf")
|
||||
Dim result2 = Await Client.Validation.ValidatePdfAsync(pdfBytes)
|
||||
Dim result2 = Await Client.Validation.ValidateAsync(pdfBytes)
|
||||
```
|
||||
|
||||
```powershell
|
||||
@@ -321,7 +321,7 @@ Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
# Variante A: Stream
|
||||
$stream = [System.IO.File]::OpenRead("rechnung.pdf")
|
||||
$result = [DocumentService.Client.Client]::Validation.ValidatePdfAsync($stream).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::Validation.ValidateAsync($stream).GetAwaiter().GetResult()
|
||||
$stream.Dispose()
|
||||
|
||||
Write-Host "Seiten: $($result.PageCount)"
|
||||
@@ -332,7 +332,7 @@ Write-Host "Dateigroesse: $($result.FileSizeMB.ToString('F2')) MB"
|
||||
|
||||
# Variante B: byte[]
|
||||
$pdfBytes = [System.IO.File]::ReadAllBytes("rechnung.pdf")
|
||||
$result2 = [DocumentService.Client.Client]::Validation.ValidatePdfAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
$result2 = [DocumentService.Client.Client]::Validation.ValidateAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
```
|
||||
|
||||
---
|
||||
@@ -422,7 +422,7 @@ if ($result.Warnings.Count -gt 0) {
|
||||
using DocumentService.Client;
|
||||
|
||||
byte[] pdfBytes = await File.ReadAllBytesAsync("dokument.pdf");
|
||||
var check = await Client.Attachment.CheckAttachmentsAsync(pdfBytes);
|
||||
var check = await Client.Attachment.CheckAsync(pdfBytes);
|
||||
|
||||
Console.WriteLine($"Hat Anhänge: {check.HasAttachments}");
|
||||
Console.WriteLine($"Anzahl: {check.AttachmentCount}");
|
||||
@@ -435,7 +435,7 @@ foreach (var attachment in check.Attachments)
|
||||
Imports DocumentService.Client
|
||||
|
||||
Dim pdfBytes = System.IO.File.ReadAllBytes("dokument.pdf")
|
||||
Dim check = Await Client.Attachment.CheckAttachmentsAsync(pdfBytes)
|
||||
Dim check = Await Client.Attachment.CheckAsync(pdfBytes)
|
||||
|
||||
Console.WriteLine($"Hat Anhänge: {check.HasAttachments}")
|
||||
Console.WriteLine($"Anzahl: {check.AttachmentCount}")
|
||||
@@ -449,7 +449,7 @@ Next
|
||||
Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
$pdfBytes = [System.IO.File]::ReadAllBytes("dokument.pdf")
|
||||
$check = [DocumentService.Client.Client]::Attachment.CheckAttachmentsAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
$check = [DocumentService.Client.Client]::Attachment.CheckAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
|
||||
Write-Host "Hat Anhaenge: $($check.HasAttachments)"
|
||||
Write-Host "Anzahl: $($check.AttachmentCount)"
|
||||
@@ -467,7 +467,7 @@ Rückgabe: `Dictionary<string, Stream>` – Schlüssel = ursprünglicher Dateina
|
||||
using DocumentService.Client;
|
||||
|
||||
using var pdfStream = File.OpenRead("dokument_mit_anhaengen.pdf");
|
||||
var files = await Client.Attachment.ExtractAttachmentsAsync(pdfStream);
|
||||
var files = await Client.Attachment.ExtractAsync(pdfStream);
|
||||
|
||||
foreach (var (fileName, fileStream) in files)
|
||||
{
|
||||
@@ -484,7 +484,7 @@ foreach (var (fileName, fileStream) in files)
|
||||
Imports DocumentService.Client
|
||||
|
||||
Dim pdfStream As New System.IO.FileStream("dokument_mit_anhaengen.pdf", System.IO.FileMode.Open)
|
||||
Dim files = Await Client.Attachment.ExtractAttachmentsAsync(pdfStream)
|
||||
Dim files = Await Client.Attachment.ExtractAsync(pdfStream)
|
||||
pdfStream.Dispose()
|
||||
|
||||
For Each entry In files
|
||||
@@ -503,7 +503,7 @@ Next
|
||||
Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
$pdfStream = [System.IO.File]::OpenRead("dokument_mit_anhaengen.pdf")
|
||||
$files = [DocumentService.Client.Client]::Attachment.ExtractAttachmentsAsync($pdfStream).GetAwaiter().GetResult()
|
||||
$files = [DocumentService.Client.Client]::Attachment.ExtractAsync($pdfStream).GetAwaiter().GetResult()
|
||||
$pdfStream.Dispose()
|
||||
|
||||
New-Item -ItemType Directory -Force -Path "output" | Out-Null
|
||||
@@ -522,7 +522,7 @@ foreach ($entry in $files.GetEnumerator()) {
|
||||
}
|
||||
```
|
||||
|
||||
> **Hinweis – `AddAttachmentsAsync`:** Das Einbetten von Anhängen in PDF/A-3-Dokumente ist für eine zukünftige Version geplant. Die Methode ist bereits im Interface definiert, jedoch als `[Obsolete]` markiert und wirft zur Laufzeit eine `NotImplementedException`. Der API-Endpunkt `POST /api/pdf/attachments/add` ist noch nicht implementiert.
|
||||
> **Hinweis – `AddAsync`:** Das Einbetten von Anhängen in PDF/A-3-Dokumente ist für eine zukünftige Version geplant. Die Methode ist bereits im Interface definiert, jedoch als `[Obsolete]` markiert und wirft zur Laufzeit eine `NotImplementedException`. Der API-Endpunkt `POST /api/pdf/attachments/add` ist noch nicht implementiert.
|
||||
|
||||
---
|
||||
|
||||
@@ -841,7 +841,7 @@ using DocumentService.Client;
|
||||
|
||||
// Geparste Rechnungsstruktur gemäß Swiss QR Bill Standard 2.0
|
||||
byte[] pdfBytes = await File.ReadAllBytesAsync("qr-rechnung.pdf");
|
||||
var result = await Client.SwissQrCode.ExtractSwissQrCodeAsync(pdfBytes, raw: false);
|
||||
var result = await Client.SwissQrCode.ExtractAsync(pdfBytes, raw: false);
|
||||
|
||||
Console.WriteLine($"Betrag: {result.Bill?.Amount} {result.Bill?.Currency}");
|
||||
Console.WriteLine($"Konto: {result.Bill?.Account}");
|
||||
@@ -854,7 +854,7 @@ Console.WriteLine($"Mitteilung:{result.Bill?.UnstructuredMessage}");
|
||||
Imports DocumentService.Client
|
||||
|
||||
Dim pdfBytes = System.IO.File.ReadAllBytes("qr-rechnung.pdf")
|
||||
Dim result = Await Client.SwissQrCode.ExtractSwissQrCodeAsync(pdfBytes, raw:=False)
|
||||
Dim result = Await Client.SwissQrCode.ExtractAsync(pdfBytes, raw:=False)
|
||||
|
||||
Console.WriteLine($"Betrag: {result.Bill?.Amount} {result.Bill?.Currency}")
|
||||
Console.WriteLine($"Konto: {result.Bill?.Account}")
|
||||
@@ -867,7 +867,7 @@ Console.WriteLine($"Mitteilung:{result.Bill?.UnstructuredMessage}")
|
||||
Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
$pdfBytes = [System.IO.File]::ReadAllBytes("qr-rechnung.pdf")
|
||||
$result = [DocumentService.Client.Client]::SwissQrCode.ExtractSwissQrCodeAsync($pdfBytes, $false).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::SwissQrCode.ExtractAsync($pdfBytes, $false).GetAwaiter().GetResult()
|
||||
|
||||
Write-Host "Betrag: $($result.Bill.Amount) $($result.Bill.Currency)"
|
||||
Write-Host "Konto: $($result.Bill.Account)"
|
||||
@@ -883,7 +883,7 @@ Write-Host "Mitteilung:$($result.Bill.UnstructuredMessage)"
|
||||
```csharp
|
||||
// Ohne Parsing – direkt aus dem QR-Code-Inhalt
|
||||
using var pdfStream = File.OpenRead("qr-rechnung.pdf");
|
||||
var result = await Client.SwissQrCode.ExtractSwissQrCodeAsync(pdfStream, raw: true);
|
||||
var result = await Client.SwissQrCode.ExtractAsync(pdfStream, raw: true);
|
||||
|
||||
foreach (var line in result.RawLines)
|
||||
Console.WriteLine(line);
|
||||
@@ -891,7 +891,7 @@ foreach (var line in result.RawLines)
|
||||
|
||||
```vbnet
|
||||
Dim pdfStream As New System.IO.FileStream("qr-rechnung.pdf", System.IO.FileMode.Open)
|
||||
Dim result = Await Client.SwissQrCode.ExtractSwissQrCodeAsync(pdfStream, raw:=True)
|
||||
Dim result = Await Client.SwissQrCode.ExtractAsync(pdfStream, raw:=True)
|
||||
pdfStream.Dispose()
|
||||
|
||||
For Each line In result.RawLines
|
||||
@@ -901,7 +901,7 @@ Next
|
||||
|
||||
```powershell
|
||||
$pdfStream = [System.IO.File]::OpenRead("qr-rechnung.pdf")
|
||||
$result = [DocumentService.Client.Client]::SwissQrCode.ExtractSwissQrCodeAsync($pdfStream, $true).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::SwissQrCode.ExtractAsync($pdfStream, $true).GetAwaiter().GetResult()
|
||||
$pdfStream.Dispose()
|
||||
|
||||
foreach ($line in $result.RawLines) { Write-Host $line }
|
||||
@@ -919,7 +919,7 @@ foreach ($line in $result.RawLines) { Write-Host $line }
|
||||
using DocumentService.Client;
|
||||
|
||||
byte[] pdfBytes = await File.ReadAllBytesAsync("eingangsrechnung.pdf");
|
||||
var check = await Client.Zugferd.HasZugferdAsync(pdfBytes);
|
||||
var check = await Client.Zugferd.CheckAsync(pdfBytes);
|
||||
|
||||
Console.WriteLine($"Enthält ZUGFeRD: {check.HasZugferd}");
|
||||
|
||||
@@ -935,7 +935,7 @@ if (check.HasZugferd)
|
||||
Imports DocumentService.Client
|
||||
|
||||
Dim pdfBytes = System.IO.File.ReadAllBytes("eingangsrechnung.pdf")
|
||||
Dim check = Await Client.Zugferd.HasZugferdAsync(pdfBytes)
|
||||
Dim check = Await Client.Zugferd.CheckAsync(pdfBytes)
|
||||
|
||||
Console.WriteLine($"Enthält ZUGFeRD: {check.HasZugferd}")
|
||||
|
||||
@@ -950,7 +950,7 @@ End If
|
||||
Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
$pdfBytes = [System.IO.File]::ReadAllBytes("eingangsrechnung.pdf")
|
||||
$check = [DocumentService.Client.Client]::Zugferd.HasZugferdAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
$check = [DocumentService.Client.Client]::Zugferd.CheckAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
|
||||
Write-Host "Enthaelt ZUGFeRD: $($check.HasZugferd)"
|
||||
|
||||
@@ -965,7 +965,7 @@ if ($check.HasZugferd) {
|
||||
|
||||
```csharp
|
||||
using var pdfStream = File.OpenRead("eingangsrechnung.pdf");
|
||||
using var xmlStream = await Client.Zugferd.ExtractZugferdAsync(pdfStream);
|
||||
using var xmlStream = await Client.Zugferd.ExtractAsync(pdfStream);
|
||||
|
||||
await using var output = File.Create("factur-x.xml");
|
||||
await xmlStream.CopyToAsync(output);
|
||||
@@ -974,7 +974,7 @@ Console.WriteLine("ZUGFeRD-XML gespeichert.");
|
||||
|
||||
```vbnet
|
||||
Dim pdfStream As New System.IO.FileStream("eingangsrechnung.pdf", System.IO.FileMode.Open)
|
||||
Dim xmlStream = Await Client.Zugferd.ExtractZugferdAsync(pdfStream)
|
||||
Dim xmlStream = Await Client.Zugferd.ExtractAsync(pdfStream)
|
||||
pdfStream.Dispose()
|
||||
|
||||
Using output = System.IO.File.Create("factur-x.xml")
|
||||
@@ -986,7 +986,7 @@ Console.WriteLine("ZUGFeRD-XML gespeichert.")
|
||||
|
||||
```powershell
|
||||
$pdfStream = [System.IO.File]::OpenRead("eingangsrechnung.pdf")
|
||||
$xmlStream = [DocumentService.Client.Client]::Zugferd.ExtractZugferdAsync($pdfStream).GetAwaiter().GetResult()
|
||||
$xmlStream = [DocumentService.Client.Client]::Zugferd.ExtractAsync($pdfStream).GetAwaiter().GetResult()
|
||||
$pdfStream.Dispose()
|
||||
|
||||
$output = [System.IO.File]::Create("factur-x.xml")
|
||||
@@ -1000,7 +1000,7 @@ Write-Host "ZUGFeRD-XML gespeichert."
|
||||
|
||||
```csharp
|
||||
byte[] pdfBytes = await File.ReadAllBytesAsync("eingangsrechnung.pdf");
|
||||
var result = await Client.Zugferd.ExtractZugferdAsResultAsync(pdfBytes);
|
||||
var result = await Client.Zugferd.ExtractAsResultAsync(pdfBytes);
|
||||
|
||||
Console.WriteLine($"Dateiname: {result.FileName}");
|
||||
Console.WriteLine($"Größe: {result.FileSize} Bytes");
|
||||
@@ -1012,7 +1012,7 @@ var doc = XDocument.Parse(result.XmlContent);
|
||||
|
||||
```vbnet
|
||||
Dim pdfBytes = System.IO.File.ReadAllBytes("eingangsrechnung.pdf")
|
||||
Dim result = Await Client.Zugferd.ExtractZugferdAsResultAsync(pdfBytes)
|
||||
Dim result = Await Client.Zugferd.ExtractAsResultAsync(pdfBytes)
|
||||
|
||||
Console.WriteLine($"Dateiname: {result.FileName}")
|
||||
Console.WriteLine($"Größe: {result.FileSize} Bytes")
|
||||
@@ -1024,7 +1024,7 @@ Dim doc = System.Xml.Linq.XDocument.Parse(result.XmlContent)
|
||||
|
||||
```powershell
|
||||
$pdfBytes = [System.IO.File]::ReadAllBytes("eingangsrechnung.pdf")
|
||||
$result = [DocumentService.Client.Client]::Zugferd.ExtractZugferdAsResultAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::Zugferd.ExtractAsResultAsync($pdfBytes).GetAwaiter().GetResult()
|
||||
|
||||
Write-Host "Dateiname: $($result.FileName)"
|
||||
Write-Host "Groesse: $($result.FileSize) Bytes"
|
||||
@@ -1047,20 +1047,20 @@ $doc = [System.Xml.Linq.XDocument]::Parse($result.XmlContent)
|
||||
```csharp
|
||||
// NICHT VERWENDEN – wirft NotImplementedException
|
||||
#pragma warning disable CS0618
|
||||
using var pdfAStream = await Client.Conversion.ConvertToPdfAAsync(pdfStream, pdfALevel: "PDF/A-3b");
|
||||
using var pdfAStream = await Client.Conversion.ToPdfAAsync(pdfStream, pdfALevel: "PDF/A-3b");
|
||||
#pragma warning restore CS0618
|
||||
```
|
||||
|
||||
```vbnet
|
||||
' NICHT VERWENDEN – wirft NotImplementedException
|
||||
#Disable Warning BC40000
|
||||
Dim pdfAStream = Await Client.Conversion.ConvertToPdfAAsync(pdfStream, pdfALevel:="PDF/A-3b")
|
||||
Dim pdfAStream = Await Client.Conversion.ToPdfAAsync(pdfStream, pdfALevel:="PDF/A-3b")
|
||||
#Enable Warning BC40000
|
||||
```
|
||||
|
||||
```powershell
|
||||
# NICHT VERWENDEN – wirft NotImplementedException
|
||||
$pdfAStream = [DocumentService.Client.Client]::Conversion.ConvertToPdfAAsync($pdfStream, "PDF/A-3b").GetAwaiter().GetResult()
|
||||
$pdfAStream = [DocumentService.Client.Client]::Conversion.ToPdfAAsync($pdfStream, "PDF/A-3b").GetAwaiter().GetResult()
|
||||
```
|
||||
|
||||
Sobald die Endpunkte auf dem Server bereitgestellt werden, entfällt das `[Obsolete]`-Attribut und die Methoden sind ohne weiteren Anpassungsbedarf auf Clientseite verwendbar.
|
||||
@@ -1071,21 +1071,21 @@ Sobald die Endpunkte auf dem Server bereitgestellt werden, entfällt das `[Obsol
|
||||
|
||||
| **Client-Eigenschaft** | **Methode** | **API-Endpunkt** | **Status** | **Beschreibung** |
|
||||
|---|---|---|---|---|
|
||||
| `Client.Validation` | `ValidatePdfAsync()` | `POST /api/pdf/validation/validate` | ✅ Verfügbar | PDF validieren, Metadaten abrufen |
|
||||
| `Client.Validation` | `ValidateAsync()` | `POST /api/pdf/validation/validate` | ✅ Verfügbar | PDF validieren, Metadaten abrufen |
|
||||
| `Client.Validation` | `ValidatePdfAAsync()` | `POST /api/pdf/validation/validate-pdfa` | ✅ Verfügbar | PDF/A-Konformität prüfen |
|
||||
| `Client.Attachment` | `CheckAttachmentsAsync()` | `POST /api/pdf/attachments/check` | ✅ Verfügbar | Eingebettete Anhänge erkennen |
|
||||
| `Client.Attachment` | `ExtractAttachmentsAsync()` | `POST /api/pdf/attachments/extract` | ✅ Verfügbar | Anhänge extrahieren als `Dictionary<string, Stream>` |
|
||||
| `Client.Attachment` | `AddAttachmentsAsync()` | `POST /api/pdf/attachments/add` | ⏳ Geplant | Anhänge in PDF/A-3 einbetten |
|
||||
| `Client.Attachment` | `CheckAsync()` | `POST /api/pdf/attachments/check` | ✅ Verfügbar | Eingebettete Anhänge erkennen |
|
||||
| `Client.Attachment` | `ExtractSwissQrCodeAsync()` | `POST /api/pdf/attachments/extract` | ✅ Verfügbar | Anhänge extrahieren als `Dictionary<string, Stream>` |
|
||||
| `Client.Attachment` | `AddAsync()` | `POST /api/pdf/attachments/add` | ⏳ Geplant | Anhänge in PDF/A-3 einbetten |
|
||||
| `Client.Operations` | `MergeAsync()` | `POST /api/pdf/operations/merge` | ✅ Verfügbar | Mehrere PDFs zusammenführen |
|
||||
| `Client.Operations` | `AnnotateAsync()` | `POST /api/pdf/operations/annotate` | ✅ Verfügbar | Annotationen hinzufügen |
|
||||
| `Client.Operations` | `StampAsync()` | `POST /api/pdf/operations/stamp` | ✅ Verfügbar | Text-/Bildstempel hinzufügen |
|
||||
| `Client.SwissQrCode` | `ExtractSwissQrCodeAsync()` | `POST /api/pdf/qr-code/extract-swiss` | ✅ Verfügbar | Schweizer QR-Code-Daten extrahieren |
|
||||
| `Client.Zugferd` | `HasZugferdAsync()` | `POST /api/pdf/zugferd/has-zugferd` | ✅ Verfügbar | ZUGFeRD-Einbettung prüfen |
|
||||
| `Client.Zugferd` | `ExtractZugferdAsync()` | `POST /api/pdf/zugferd/extract` | ✅ Verfügbar | ZUGFeRD-XML als Stream |
|
||||
| `Client.Zugferd` | `ExtractZugferdAsResultAsync()` | `POST /api/pdf/zugferd/extract` | ✅ Verfügbar | ZUGFeRD-XML mit Metadaten als Objekt |
|
||||
| `Client.Conversion` | `ConvertToPdfAAsync()` | `POST /api/pdf/conversion/to-pdfa` | ⏳ Geplant | PDF zu PDF/A konvertieren |
|
||||
| `Client.Conversion` | `ConvertFromPdfAAsync()` | `POST /api/pdf/conversion/from-pdfa` | ⏳ Geplant | PDF/A-Einschränkungen aufheben |
|
||||
| `Client.Workflows` | `ExtractSwissQrCodeValidatedAsync()` | — | ✅ Verfügbar | Validierung + Swiss QR Code Extraktion in einem Schritt |
|
||||
| `Client.Zugferd` | `CheckAsync()` | `POST /api/pdf/zugferd/has-zugferd` | ✅ Verfügbar | ZUGFeRD-Einbettung prüfen |
|
||||
| `Client.Zugferd` | `ExtractSwissQrCodeAsync()` | `POST /api/pdf/zugferd/extract` | ✅ Verfügbar | ZUGFeRD-XML als Stream |
|
||||
| `Client.Zugferd` | `ExtractAsResultAsync()` | `POST /api/pdf/zugferd/extract` | ✅ Verfügbar | ZUGFeRD-XML mit Metadaten als Objekt |
|
||||
| `Client.Conversion` | `ToPdfAAsync()` | `POST /api/pdf/conversion/to-pdfa` | ⏳ Geplant | PDF zu PDF/A konvertieren |
|
||||
| `Client.Conversion` | `FromPdfAAsync()` | `POST /api/pdf/conversion/from-pdfa` | ⏳ Geplant | PDF/A-Einschränkungen aufheben |
|
||||
| `Client.Workflows` | `ExtractSwissQrCodeAsync()` | — | ✅ Verfügbar | Validierung + Swiss QR Code Extraktion in einem Schritt |
|
||||
|
||||
> **⏳ Geplant:** Der Client-Code ist vorhanden und kompiliert fehlerfrei. Ein Aufruf zur Laufzeit wirft jedoch `NotImplementedException`, da der serverseitige Endpunkt noch nicht existiert. Die Methoden sind mit `[Obsolete]` markiert, sodass der Compiler eine Build-Warnung ausgibt.
|
||||
|
||||
@@ -1099,7 +1099,7 @@ using DocumentService.Client;
|
||||
try
|
||||
{
|
||||
using var stream = File.OpenRead("dokument.pdf");
|
||||
var result = await Client.Validation.ValidatePdfAsync(stream);
|
||||
var result = await Client.Validation.ValidateAsync(stream);
|
||||
Console.WriteLine($"Seiten: {result.PageCount}");
|
||||
}
|
||||
catch (InvalidOperationException ex) when (ex.Message.Contains("not configured"))
|
||||
@@ -1129,7 +1129,7 @@ Imports DocumentService.Client
|
||||
|
||||
Try
|
||||
Dim stream As New System.IO.FileStream("dokument.pdf", System.IO.FileMode.Open)
|
||||
Dim result = Await Client.Validation.ValidatePdfAsync(stream)
|
||||
Dim result = Await Client.Validation.ValidateAsync(stream)
|
||||
stream.Dispose()
|
||||
Console.WriteLine($"Seiten: {result.PageCount}")
|
||||
Catch ex As InvalidOperationException When ex.Message.Contains("not configured")
|
||||
@@ -1148,7 +1148,7 @@ Add-Type -Path "DocumentService.Client.dll"
|
||||
|
||||
try {
|
||||
$stream = [System.IO.File]::OpenRead("dokument.pdf")
|
||||
$result = [DocumentService.Client.Client]::Validation.ValidatePdfAsync($stream).GetAwaiter().GetResult()
|
||||
$result = [DocumentService.Client.Client]::Validation.ValidateAsync($stream).GetAwaiter().GetResult()
|
||||
$stream.Dispose()
|
||||
Write-Host "Seiten: $($result.PageCount)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user