Added the following projects to `DocumentOperator.sln`:
- `core`, `presentation`, `infrastructure`, `src`, `tests`
Updated `GlobalSection(NestedProjects)` to define hierarchical
relationships between projects for better organization. Nested
projects include `core`, `presentation`, and `infrastructure`
under `src`, among others.
Introduced endpoints for embedding attachments in PDFs and converting
between standard PDFs and PDF/A formats. Added `PdfAttachmentController`
and `PdfConversionController` with multipart/form-data and Base64-based
support. Implemented commands, handlers, and validators for these
operations.
Extended `IPdfProcessor` with methods for adding attachments and
PDF/A conversion. Partially implemented functionality in
`DevExpressPdfProcessor`, including `ConvertFromPdfAAsync`.
Added `attachment.xml` and `withoutAttachment.pdf` as resources for
testing. Marked endpoints as `[Obsolete]` to indicate incomplete
implementation. Improved validation and error handling for commands.
Enhanced `ExtractZugferdFromFile` and `ExtractZugferdFromBase64`
methods to support output as an XML file (`application/xml`)
or JSON (default). Introduced `asFile` and `format` query
parameters to control the output format. Updated XML
documentation and `ProducesResponseType` attributes to reflect
these changes. Default values for `CancellationToken` were
set to `default` for improved usability.
Introduced `ZugferdController` to handle ZUGFeRD-related operations, including detection and extraction of ZUGFeRD XML from PDFs via file upload or Base64-encoded payloads. Integrated `MediatR` for query/command handling.
Added `ZugferdSettings` for configurable file names and patterns, and updated `appsettings.json` and `Program.cs` to support this configuration.
Implemented `HasZugferdQuery` and `ExtractZugferdCommand` with their respective handlers and validators. Added DTOs (`ZugferdCheckResult`, `ZugferdExtractionResult`) for operation results.
Included `ZUGFeRD-Example.pdf` for testing and integrated `Serilog.Ui.Core.Extensions` for logging.
- Read LuckyPennySoftLicenseKey from appsettings.json
- Set MediatR config.LicenseKey
- Set AutoMapper cfg.LicenseKey
- AddApplication now requires IConfiguration parameter
- Update AddSwaggerDocumentation to accept IConfiguration parameter
- Read SwaggerSettings from configuration (Title/Version/Description)
- Replace hardcoded values with dynamic settings
- Add Microsoft.Extensions.Options using for IOptions support
- Add SwaggerSettings section with EnableInProduction: true
- Title: DocumentOperator API
- Version: v1
- Description: PDF document processing service using DevExpress
- Production Swagger enabled by default
- Add SwaggerSettings with EnableInProduction flag (default: true)
- Title, Version, Description configurable via appsettings.json
- Enables production Swagger access for debugging/testing
Implemented the "PDF Stamp Operation" feature, allowing users to add text, image, or predefined stamps to PDF documents.
- Added `FEATURE_7_PLAN.md` with detailed implementation plan.
- Introduced enums (`StampType`, `PredefinedStampType`, `StampPlacement`) in the domain layer.
- Added `AddStampAsync` method to `IPdfProcessor` interface.
- Implemented `AddStampAsync` in `DevExpressPdfProcessor` using DevExpress API.
- Created unit tests for `AddStampAsync` covering various scenarios.
- Added `AddStampCommand` in the application layer with validation rules.
- Created two new endpoints in `PdfOperationsController` for multipart and Base64 inputs.
- Added DTOs for handling endpoint requests.
- Wrote integration tests for endpoints to ensure correctness.
- Updated `AGENTS.md` and added DevExpress API references.
- Documented challenges, considerations, and estimated effort.
This commit completes the "PDF Stamp Operation" feature with full test coverage and documentation.
Add IIS publish profile for Web Deploy packaging
Added `IISProfile.pubxml` to configure publishing via Web Deploy.
Set the publish method to `Package` and specified build settings
(`Release`, `Any CPU`). Configured the output package location,
enabled single-file packaging, and set the IIS app path to
`DocumentOperator.API`. Target framework updated to .NET 8.0.
Updates:
- Mark stamp endpoint as DONE in Current Status table
- Add Serilog.UI packages to Key Libraries table
- Update test count (Feature 7 instead of Feature 6)
- Add Serilog UI URL to Build/Run section
- Document log viewer access at /serilog-ui
- Update AddAnnotationFromFile/AddAnnotationFromBase64 endpoints
- Add Origin parameter to multipart/JSON request DTOs
- Add Width/Height as alternative to X2/Y2 in requests
- Calculate X2/Y2 from Width/Height if provided
- XML documentation updated with new parameters
- Add Origin parameter (default: BottomLeft)
- Add Width/Height as alternatives to X2/Y2
- Validation: Either (X2+Y2) OR (Width+Height) required, not both
- FluentValidation rules enforce mutual exclusivity
- Create AddAnnotationCommand (Command/Handler/Validator merged in single file)
- Use primary constructors for handler (IPdfProcessor dependency)
- FluentValidation rules: stream required, pageNumber > 0, content for FreeText/StickyNote
- Validate textMarkupStyle required for TextMarkup annotations
- Validate color format (6-digit hex) and rectangle coordinates (X2>X1, Y2>Y1)
Application Handler Tests:
- ValidatePdfHandlerTests: PdfStream = new MemoryStream(pdfBytes)
- ValidatePdfAQueryHandlerTests: PdfStream = new MemoryStream(pdfBytes)
- CheckPdfAttachmentsQueryHandlerTests: PdfStream = new MemoryStream(pdfBytes)
- Remove Base64/PdfBytes property usage
Infrastructure Tests:
- DevExpressSwissQrCodeProcessorTests: LoadTestPdf() returns Stream
- All test methods use 'using var stream' pattern
- Add test: ExtractSwissQrCodeAsync_StreamNotAtBeginning_ThrowsBadRequestException
Result: All unit tests pass with Stream-based API
Deleted:
- PdfProcessingException: Obsolete, DevExpress exceptions now propagate naturally
- SwissQrCodeNotFoundException: Moved to Application layer (feature-specific exception)
Rationale:
- PdfProcessingException was wrapping library exceptions unnecessarily
- Better to let infrastructure exceptions propagate → middleware handles as 500
- SwissQrCodeNotFoundException is application-level concern, not domain
Remove FormatException/ArgumentException handling:
- These are framework exceptions, not application-specific
- May come from internal libraries (false positives for 400 Bad Request)
- Controllers now wrap Base64 conversion with BadRequestException explicitly
Remove PdfProcessingException handling:
- Exception type removed (obsolete)
- DevExpress exceptions now propagate naturally → 500 Internal Server Error
Current exception mapping:
- ValidationException (FluentValidation) → 400 Bad Request
- BadRequestException (custom) → 400 Bad Request
- NotFoundException (custom) → 404 Not Found
- SwissQrCodeNotFoundException (custom) → 404 Not Found
- All others → 500 Internal Server Error