Added `PdfALevel` and `PdfAWarning` properties to the `PdfExtractionResult` class to store the PDF/A compliance level and indicate if a warning should be displayed for non-compliance. Updated `Upload.cshtml` to display the PDF/A compliance level and conditionally show a warning message if the document is not PDF/A compliant. Enhanced `PdfAttachmentExtractorService` to determine the PDF/A compliance level using `PdfDocumentProcessor`, map it to a string representation, and log the compliance level. Added logic to set `PdfAWarning` for non-compliant documents.
28 lines
937 B
C#
28 lines
937 B
C#
namespace DXApp.TemplateKitProject.Models;
|
|
|
|
public class PdfExtractionResult
|
|
{
|
|
public List<ExtractedAttachment> Attachments { get; init; } = [];
|
|
public bool HasAttachments => Attachments.Count > 0;
|
|
|
|
public ExtractedAttachment? ZugferdXmlAttachment =>
|
|
Attachments.FirstOrDefault(a => a.IsZugferdXml);
|
|
|
|
public bool HasZugferdXml => ZugferdXmlAttachment is not null;
|
|
|
|
// Welche PDF/A-Stufe hat das Dokument?
|
|
// Beispiel: "PDF/A-3b", "PDF/A-2b", oder "Kein PDF/A"
|
|
public string PdfALevel { get; set; } = string.Empty;
|
|
|
|
// Soll eine Warnung angezeigt werden?
|
|
// true wenn kein PDF/A → ZUGFeRD-Rechnungen müssen PDF/A-3b sein
|
|
public bool PdfAWarning { get; set; }
|
|
}
|
|
|
|
public class ExtractedAttachment
|
|
{
|
|
public string OriginalFileName { get; init; }
|
|
public string SavedFilePath { get; init; }
|
|
public long FileSizeBytes { get; init; }
|
|
public bool IsZugferdXml { get; init; }
|
|
} |