Commit Graph

6 Commits

Author SHA1 Message Date
OlgunR
43d63e975d Enhance PDF processing and report integration
Refactor `PdfResultPackageService` to improve PDF handling:
- Load the main document into `PdfDocumentProcessor`.
- Remove original metadata to attribute the result to `DXApp`.
- Replace report file attachment with appending report pages.
- Use a temporary processor to determine report page count.
- Add logging for appended pages and total page count.
- Update save operation to include detailed logging.

Removed the functionality to attach the report file as a PDF attachment.
Improved overall usability, traceability, and document attribution.
2026-06-02 14:06:24 +02:00
OlgunR
2ae2bbdaf6 Update PDF metadata handling in PdfResultPackageService
Introduce functionality to remove and replace metadata in the
resulting PDF document. After loading the document with
`PdfDocumentProcessor`, the metadata fields (`Author`, `Creator`,
`Producer`, `Title`, `Subject`, and `Keywords`) are cleared or
replaced with values indicating the document was processed by
the "DXApp" system. This ensures proper attribution and removes
any association with the original document creator.
2026-06-01 16:32:25 +02:00
OlgunR
a087baa089 Add stamp to first page of PDF documents
Introduce functionality to add a stamp to the top-right corner of
the first page of a PDF. The stamp includes a white background,
a green border, and two lines of text: "✔ VERARBEITET" in bold
green font and the current date/time in gray font. The stamp is
drawn using `DevExpress.Pdf.PdfDocumentProcessor` and saved to
the document's foreground.
2026-05-29 11:26:25 +02:00
OlgunR
98226f239b Adjust logging levels to reduce verbosity
Changed logging levels from LogInformation to LogDebug in
PdfAttachmentExtractorService and PdfResultPackageService.
This includes logs for PDF conformity levels, ZUGFeRD
Guideline-IDs, saved attachment details, and result report
discovery. These changes aim to reduce log verbosity in
production environments by moving less critical information
to the debug level.
2026-05-29 09:52:05 +02:00
OlgunR
1144c45826 Improve error handling in PDF processing workflow
Refactored the PDF processing workflow to enhance error handling
and provide more descriptive exception messages. Added `try-catch`
blocks around the PDF/A-3b conversion and document saving steps
to handle potential failures.

Labeled the workflow steps for clarity:
- Step 1: Convert to PDF/A-3b
- Step 2: Buffer converted PDF
- Step 3: Embed attachment
- Step 4: Save document

Removed redundant `MemoryStream` initialization for the original
PDF and updated comments to improve code readability and
maintainability.
2026-05-29 09:20:34 +02:00
OlgunR
87f27682ce Add support for generating result PDFs
Introduced the `ResultFilePath` property in the `ZugferdInvoice` model to store the path of generated result PDFs. Added a new service, `PdfResultPackageService`, to create result PDFs by converting the original PDF to PDF/A-3b format and attaching a report file. Updated `Upload.cshtml` and `Upload.cshtml.cs` to handle and display the `ResultFilePath`.

Created a migration to add the `ResultFilePath` column to the database. Updated `Program.cs` to register the new service and added configuration sections in `appsettings.json` for input and output directories. Enhanced error handling and logging for better traceability.
2026-05-27 13:43:14 +02:00