Updated the `using` directives in `SignatureDto.cs` to include the `EnvelopeGenerator.Domain.Constants` namespace and reordered the existing namespaces. Added a new `SenderAppType` property to the `SignatureDto` class, with a default value of `SenderAppType.LegacyFormApp`.
A new namespace `EnvelopeGenerator.Domain.Constants` was added,
containing the `SenderAppType` enumeration. This enum defines
two members: `LegacyFormApp` (0) and `ReceiverUIBlazorApp` (1).
The addition improves type safety and maintainability by
providing a structured way to differentiate between sender
application types.
Updated the digital document signing system to use INCHES as the standard unit for annotations and signatures, aligning with GdPicture14's native format. Previously used DevExpress units (1/100 inch) and other formats have been replaced.
- Updated `AnnotationDto` to reflect the new coordinate system.
- Introduced `SignatureDto` for signature positions, deprecating `AnnotationDto`.
- Added conversion formulas for transforming coordinates between INCHES and other systems (DevExpress, PDF Points, PDF.js, etc.).
- Added a unit comparison table and A4 page dimensions in various units.
- Introduced a new read-only PDF.js viewer for envelopes (`/envelope/{EnvelopeKey}`).
These changes improve consistency, simplify conversions, and align with modern tools like PSPDFKit and iText7.
Added a new solution item `OPEN_TASK_SESSION_12.md` to the
`src` project section in the `EnvelopeGenerator.sln` file.
This was included under the `SolutionItems` subsection of
the `src` project.
Updated documentation and code comments to reflect INCHES as the
coordinate unit instead of 1/100 inch. Replaced special characters
causing issues with proper symbols (e.g., `—`, `≈`, `→`).
- Updated VB.NET code snippet to clarify INCHES usage.
- Revised `COPILOT_CONTEXT_EN.md` with updated formulas, unit
comparison tables, and database storage format details.
- Corrected XML documentation for `SignatureDto` and `AnnotationDto`
in C# to reflect INCHES as the unit.
- Clarified database schema documentation for coordinate fields.
- Improved unit conversion quick reference with accurate formulas.
- Added A4 page dimensions reference in multiple units.
- Marked completed tasks in "Session 12 Changes Already Completed"
with detailed descriptions.
Updated documentation and code comments to reflect that the
coordinate system uses INCHES (not 1/100 inch or DX units).
- Updated `COPILOT_CONTEXT_EN.md`:
- Clarified database stores coordinates in INCHES.
- Added conversion formulas and unit comparison table.
- Renamed section to `SignatureDto / AnnotationDto`.
- Updated XML documentation in C# files:
- `SignatureDto.cs`: Added XML comments for INCHES-based coordinates.
- `AnnotationDto.cs`: Corrected unit description and added conversions.
- `AnnotationCreateDto.cs`: Fixed `X` and `Y` property comments.
- Verified VB.NET source (`frmFieldEditor.vb`) as the unit reference.
- Added quick reference for unit conversions across systems.
Expanded `yarp.json` with new routes for the `receiver-ui` cluster to handle paths for `appsettings.json`, `appsettings.Development.json`, styles, fonts, and images. These routes specify HTTP methods and execution order.
Registered `SignatureService` as a scoped dependency in `Program.cs` to support new functionality related to handling signatures.
Replaced AnnotationDto and AnnotationService with SignatureDto
and SignatureService for handling signature data. Marked
AnnotationDto and AnnotationService as obsolete.
Added the SignatureDto class to represent signature data and
introduced the SignatureService class to fetch signature data
from the API. Updated EnvelopeViewer.razor to use
SignatureService, replacing AnnotationService, and added a
debug log for retrieved signatures.
Performed general refactoring to align with the new signature
data model and functionality.
The `GetAnnotsOfReceiver` method was removed from the `AnnotationController` class and moved to a newly introduced `SignatureController` class. The `SignatureController` is now a dedicated controller for handling signature-related endpoints, decorated with `[ApiController]` and `[Route("api/[controller]")]`.
The method's implementation remains largely unchanged, retaining its logic for retrieving and filtering signatures for a specific receiver. Dependency injection for `IMediator` was added to the `SignatureController` to handle the `ReadDocumentQuery`.
Additional `using` directives were added to `SignatureController.cs` to include necessary namespaces. A `TODO` comment remains in the method, indicating potential future updates.
A new property `Annotations` of type `IEnumerable<AnnotationDto>?`
was added to the `SignatureDto` class. This property includes a
getter and setter, allowing the class to manage a collection of
annotations. The property is nullable, enabling it to hold a
`null` value if no annotations are present.
Refactored the `Handle` method in `ReadDocumentQueryHandler` to
eagerly load related data (`Elements` and `Annotations`) using
`Include` and `ThenInclude`. Introduced a reusable `docQuery`
variable to reduce code duplication and ensure consistency in
queries for both `query.Id` and `query.EnvelopeId`. No changes
were made to the mapping logic or exception handling.
Introduced the `GetAnnotsOfReceiver` method in `AnnotationController` to handle HTTP GET requests for retrieving receiver-specific annotations. The method enforces authorization using the `Receiver` policy, fetches the document via a mediator query, and filters signatures based on the current receiver. Returns appropriate HTTP responses for empty documents or missing signatures.
Added new `using` directives for required dependencies and reorganized imports for better readability. Included a `TODO` comment for potential future updates.
Updated ReceiverClaimExtensions to include a new array,
`ReceiverIdClaimTypes`, for receiver ID claim types. Added
`GetReceiverIdOfReceiver` method to retrieve and validate
receiver ID claims. Modified the exception message in
`GetEnvelopeIdOfReceiver` to use a string literal for
clarity.
Added new routes to the `ReverseProxy` configuration, including
`receiver-ui-login`, `receiver-ui-sender`, `receiver-ui-envelope`,
and others to handle specific paths, HTTP methods, and transformations.
Removed outdated routes such as `receiver-ui-static-assets` and
`receiver-ui-annotation-fake` to streamline the configuration.
Introduced transformations for response headers (e.g., `Cache-Control`)
and updated `auth-login` and `auth-envelope-receiver-login` routes
with new path patterns and query parameters.
Reorganized `receiver-ui` cluster routes to better handle static
assets (CSS, JS, Blazor framework, and content) and fake data.
Removed unnecessary console output for non-critical features, including `console.log`, `console.warn`, and `console.error` statements in `setQualityOptions`, `renderTextLayer`, and `renderThumbnail` methods. This reduces noise in production logs.
Added a CSS variable `--scale-factor` to the text layer's `style` in `renderTextLayer` to ensure proper scaling and improve text rendering accuracy. These changes enhance code cleanliness and robustness.
Integrated PDF.js to enable text selection and copy-paste functionality in the PDF viewer. Updated `EnvelopeViewer.razor` to include the necessary scripts and styles, and modified the HTML structure to add a text layer container.
Enhanced `envelope-viewer.css` with styles for the text layer and optimized canvas rendering. Added a `renderTextLayer` method in `pdf-viewer.js` to extract and render text content from PDF pages. Updated the rendering process to overlay the text layer on the canvas.
Updated `envelope-viewer.css` to enhance the layout and responsiveness of the PDF toolbar:
- Adjusted padding, gap, width, and alignment for better usability.
- Improved zoom section and slider styles for flexibility and consistency.
Enhanced `pdf-viewer.js` to handle concurrent rendering tasks:
- Added checks to prevent overlapping render tasks on the same canvas.
- Implemented error handling for rendering operations to ensure stability.
These changes improve the user experience and robustness of the PDF viewer.
Enhanced the "Mistakes History" table in `COPILOT_CONTEXT_EN.md`:
- Added a "Session" column to track when mistakes occurred.
- Updated table with session numbers for existing mistakes.
- Added new entries documenting recurring issues like over-engineering, ignoring revert instructions, and user feedback.
- Highlighted the importance of configurability and simplicity in design.
- Documented specific mistakes related to DevExpress and PDF.js.
These changes improve traceability, accountability, and alignment with user preferences.
Removed the `_comment` field from the `PdfViewer` section, which described the PDF Viewer Quality Settings.
Increased `ZoomTransitionDuration` from 150 to 900 to adjust zoom transition behavior, potentially improving user experience.
Updated EnvelopeViewer to support configurable quality settings via `PdfViewerOptions` and `appsettings.json`. Added HiDPI/Retina support, smooth zoom transitions, and unlimited zoom with configurable step percentages. Introduced a resizable thumbnail sidebar with localStorage persistence. Simplified initialization and cleanup processes, and documented new features and architecture. Improved user experience and performance compared to the legacy ReportViewer.
Added a `ZoomStepPercentage` property to `PdfViewerOptions` to allow configurable zoom step increments (1-50, default 5%). Updated `EnvelopeViewer.razor` to use this property for the zoom slider step. Modified `pdf-viewer.js` to apply the zoom step percentage for mouse wheel zoom, `zoomIn`, and `zoomOut` methods.
Included `ZoomStepPercentage` in `appsettings.json` and `setQualityOptions` for dynamic updates. Reduced `ZoomTransitionDuration` in `appsettings.json` from 900ms to 150ms for faster zoom transitions. These changes ensure consistent and customizable zoom behavior across the application.
Introduced `PdfViewerOptions` class to centralize PDF viewer
settings such as scaling, HiDPI support, zoom transitions,
and rendering delays. Bound these options to `appsettings.json`
for dynamic configuration.
Injected `PdfViewerOptions` into `EnvelopeViewer.razor` and
updated `OnInitializedAsync` to pass settings to JavaScript.
Replaced hardcoded values in `pdf-viewer.js` with configurable
options, improving maintainability and flexibility.
Enhanced rendering logic to respect HiDPI settings, maximum
DPR, and smooth zoom transitions. Improved thumbnail rendering
with configurable delays to optimize performance.
Added `image-rendering` properties and opacity transitions to `.pdf-canvas` for smoother visual effects during rendering. Introduced a `.pdf-canvas.rendering` class to indicate rendering state.
Enhanced `renderPage` method to support HiDPI displays by scaling the viewport based on device pixel ratio (up to 2) and setting both internal resolution and CSS display size for better rendering quality. Enabled high-quality rendering with `imageSmoothingEnabled` and `imageSmoothingQuality`.
Updated scroll container reference to `.pdf-canvas-wrapper` for proper alignment. Added logic to manage the `rendering` class during and after rendering, including error handling to ensure UI consistency. These changes improve both functionality and aesthetics of the PDF viewer.
Enhanced thumbnail rendering in `envelope-viewer.css` by adding `image-rendering` properties for better visual quality.
Updated `pdf-viewer.js` to support high-quality rendering with HiDPI support:
- Replaced fixed scale with dynamic scaling using `devicePixelRatio` (capped at 2x) and a base scale of 0.75.
- Adjusted canvas resolution to match scaled viewport dimensions.
- Removed inline canvas styles to delegate display size to CSS.
- Retained high-quality rendering settings for the canvas context.
These changes improve visual fidelity while maintaining performance.
Increased the scale for rendering PDF pages from 0.2 to 0.5 in the
`getViewport` method to enhance resolution and sharpness. Although
CSS scales the canvas down, the higher scale ensures better visual
quality.
Enabled high-quality rendering for the canvas context by setting
`ctx.imageSmoothingEnabled` to `true` and `ctx.imageSmoothingQuality`
to `'high'`, resulting in smoother and sharper PDF content rendering.
Updated the `.pdf-thumbnail__canvas` CSS class to replace
`max-width`, `max-height`, and `display: block` with `width`,
`height`, `object-fit: contain`, and `object-position: center`.
These changes ensure the canvas fully occupies its container,
scales proportionally without cropping, and centers the content
for better visual consistency and usability.
Refactor the `ToggleThumbnails` method to be asynchronous (`async Task`) to support asynchronous operations. Add logic to re-render thumbnails when toggled on, including forcing a UI update, waiting for DOM rendering, and invoking `RenderThumbnailsAsync`. These changes improve the user experience by ensuring thumbnails are properly updated when displayed.
Enhanced EnvelopeViewer with a thumbnail sidebar for page previews and a resizable splitter (150px-400px range) for improved navigation. Updated layout to use a flexbox design for side-by-side thumbnails and PDF canvas.
Externalized CSS for maintainability and added responsive behavior for mobile devices. Improved Blazor lifecycle handling with `firstRender` checks and sequential thumbnail rendering. Addressed known issues like vertical alignment and infinite render loops.
Introduced localStorage persistence for user preferences and enhanced zoom/navigation interactivity with global mouse events.
Introduced a resizable splitter for the PDF thumbnail sidebar, allowing users to dynamically adjust its width. Added `_thumbnailWidth` property with min/max constraints and implemented mouse event handlers (`OnSplitterMouseDown`, `OnSplitterMouseMove`, `OnSplitterMouseUp`) to manage resizing.
Integrated JavaScript interop to attach/detach resize event listeners and save user preferences to `localStorage`. Updated `pdf-viewer.js` to handle resizing state and cleanup. Styled the splitter in `envelope-viewer.css` with hover/active states and ensured smooth interaction.
Persisted thumbnail width across sessions and added error handling for `localStorage`. Enhanced user experience with intuitive resizing and improved UI flexibility.
Removed the header section of the PDF thumbnail sidebar, including the title and close button, to streamline the UI. Updated Razor logic to control sidebar visibility directly, eliminating the need for `.pdf-thumbnails--visible`. Deleted associated CSS styles for the removed elements. Retained scrolling and padding styles for the thumbnail content.
Refactor the PDF thumbnail sidebar to use Razor logic for dynamic visibility control, removing reliance on CSS-based toggling. Updated the `pdf-thumbnails` layout to use `relative` positioning and improved its integration with the viewer structure. Introduced a new `pdf-canvas-wrapper` for better styling, scrolling, and alignment of the main PDF canvas.
Enhanced responsiveness by adjusting `pdf-thumbnails`, `pdf-thumbnails__content`, and `pdf-toolbar` styles for smaller screens. Deprecated the `pdf-thumbnails--visible` class and removed redundant CSS properties to simplify the codebase. Updated the `pdf-frame` layout to use a column-based flexbox for better alignment.
These changes improve maintainability, responsiveness, and the overall user experience of the `EnvelopeViewer` component.
Updated EnvelopeViewer with layout fixes, unlimited zoom, and thumbnail navigation. Added global mouse wheel zoom (`Ctrl+Wheel`) and retry logic for thumbnail rendering. Refactored layout for responsiveness and documented a critical issue causing a blank screen and infinite render loop. Proposed next steps for resolution and provided a temporary workaround using the legacy ReportViewer.
Added delays in `EnvelopeViewer.razor` to ensure the DOM is ready and to render thumbnails sequentially, preventing browser overload and keeping the UI responsive. Enhanced error handling in `RenderThumbnailsAsync` with detailed debug logs.
In `pdf-viewer.js`, introduced a retry mechanism to wait for canvas elements to appear in the DOM and added detailed error logging for missing canvases or PDF document issues. Replaced generic comments with specific error messages to improve debugging.
These changes enhance the robustness, reliability, and user experience of the PDF viewer.
Introduced a PDF thumbnail sidebar in `EnvelopeViewer.razor` to enhance navigation between pages. Added a toggle button to show/hide the sidebar and implemented dynamic thumbnail rendering for all pages.
Updated `envelope-viewer.css` with styles for the sidebar, including hover/active states, transitions, and mobile responsiveness.
Enhanced `pdf-viewer.js` with a `renderThumbnail` method to render page previews on canvas elements. Added error handling for non-critical thumbnail rendering issues.
Improved user experience by providing an intuitive way to preview and navigate PDF pages.
Removed unnecessary `console.log` statements from `pdf-viewer.js`
and `receiver-signature.js` to reduce console output in production.
Simplified error handling in `pdf-viewer.js` for better clarity,
including consolidating error logging and removing redundant
handling for `RenderingCancelledException`.
Deleted the `debugDumpViewerDom` function and its public API
reference from `receiver-signature.js` as part of a cleanup
effort to eliminate unused debugging utilities. Streamlined
code related to event listener management in `pdf-viewer.js`
while retaining core functionality.
Updated the zoom slider in `EnvelopeViewer.razor` to allow finer adjustments by changing the step size from 25 to 1. Modified `pdf-viewer.js` to enable smoother zooming with 1% increments for `zoomIn` and `zoomOut` methods. Capped zoom levels between 0.5 and 3.0. Enhanced mouse wheel zoom behavior to adjust zoom in 1% steps and notify the .NET side of changes via `OnZoomChanged`. Ensured pages are re-rendered after each zoom adjustment.
The PDF toolbar in `EnvelopeViewer.razor` has been redesigned to improve usability and functionality. Key changes include:
- Added buttons for page navigation, zooming, and preset zoom levels.
- Introduced a zoom slider and page input field for direct control.
- Added "Fit to Width" and "Set Zoom to 100%" features.
- Updated `ZoomIn` and `ZoomOut` methods with boundary checks.
- Added new methods: `SetZoom`, `OnZoomSliderChanged`, `OnPageInputChanged`, and `FitToWidth`.
Styling updates in `envelope-viewer.css` include a modernized toolbar design with rounded corners, shadows, and responsive layouts for smaller screens.
`pdf-viewer.js` was updated with `setScale` and `fitToWidth` methods to support the new functionality. These changes enhance the interactivity, flexibility, and user experience of the PDF viewer.
Added functionality to maintain the scroll position and viewport
center of the `.pdf-frame` container during PDF page rendering.
This ensures the user's view remains centered on the same content
after re-rendering, even if the canvas dimensions change.
Implemented logic to store the scroll position and viewport center
before rendering and restore them afterward using scaling factors
calculated from the canvas's old and new dimensions.
Introduced a new EnvelopeViewer component (`EnvelopeViewer.razor`)
to replace the legacy ReportViewer for non-signing workflows.
The new viewer is based on PDF.js and provides a modern,
lightweight, and responsive user experience.
Added `pdf-viewer.js` to handle PDF rendering, zoom, pagination,
and mouse wheel control, integrated with Blazor via JSInterop.
Externalized styles to `envelope-viewer.css` with a modern
glassmorphism design.
Enhanced user experience with unlimited zoom, global mouse
wheel zoom (`Ctrl+Wheel`), and responsive design. Fixed issues
like scroll behavior and canvas size restrictions.
Updated `COPILOT_CONTEXT_EN.md` to document the new
EnvelopeViewer, its architecture, and its advantages over the
legacy ReportViewer. Added external dependencies for PDF.js
via CDN and updated project history to reflect these changes.
Added `DotNetObjectReference` in `EnvelopeViewer.razor` to enable Blazor-JS communication. Updated `OnAfterRenderAsync` to pass the reference to `pdfViewer.initialize`. Introduced `[JSInvokable]` method `OnZoomChanged` to handle zoom updates from JavaScript.
Enhanced `DisposeAsync` to clean up resources, including disposing of the `.NET reference` and invoking a JavaScript `dispose` method.
In `pdf-viewer.js`, modified `initialize` to accept a `.NET reference` and added `attachWheelEvent` to handle zooming via mouse wheel with `Ctrl`/`Meta` key. Updated `dispose` to clean up event listeners and reset the `.NET reference`. Added `getScale` to retrieve the current zoom scale.
Improved resource cleanup and event handling to prevent memory leaks and ensure stability.
Updated `.pdf-viewer-container` to vertically center content by changing `align-items` to `center`. Adjusted `.pdf-frame` dimensions to use dynamic height and width, added a maximum width, and centered text alignment. Introduced rounded corners to the gradient bar with a `border-radius`. Changed `.pdf-canvas` to `inline-block` display with `vertical-align: top`. Further refined `.pdf-frame` layout with slightly different height and width calculations.
Moved inline styles from `EnvelopeViewer.razor` to a new external
CSS file `envelope-viewer.css` for better maintainability and
separation of concerns. Added external JavaScript dependencies
(`pdf.js` and `pdf-viewer.js`) to enable PDF rendering.
Fixed encoding issues in error messages and improved the layout
structure with responsive design rules. Enhanced readability and
usability by organizing styles and ensuring proper localization
support.
Simplified the component by removing unnecessary debug output
and redundant comments. Removed the `OnAfterRenderAsync`
method, which previously handled PDF viewer initialization
and related JavaScript calls. This suggests the initialization
logic has been moved elsewhere or is no longer required in
this component.
Introduced `currentRenderTask` to track and manage rendering tasks, ensuring only one task is active at a time. Added logic to cancel ongoing tasks before starting new ones, preventing conflicts and redundant rendering.
Enhanced error handling to gracefully manage `RenderingCancelledException` and allow rendering of pending pages. Improved logging for better debugging and insights into the rendering process. Ensured clean state management by resetting `currentRenderTask` after task completion or cancellation.
Introduced a new Blazor component `EnvelopeViewer.razor` to display PDF documents with a user-friendly interface. The component supports dynamic routing via `/envelope/{EnvelopeKey}` and integrates the `pdf.js` library for efficient PDF rendering in the browser.
Key features include:
- Zoom and navigation controls (Next/Previous page, Zoom In/Out).
- Loading spinner, error handling, and fallback UI for robustness.
- Responsive design with modern styling using CSS.
- JavaScript interop via `pdf-viewer.js` for managing PDF rendering, scaling, and navigation.
Added lifecycle methods (`OnInitializedAsync`, `OnAfterRenderAsync`) for dynamic loading and rendering. Ensured asynchronous operations for smooth user interactions. Included a `DisposeAsync` method for cleanup.
The `ForceToUseFakeDocument` property in the `Api` section of
`appsettings.json` was changed from `true` to `false`. This
modification alters the application's behavior to no longer
force the use of fake documents, potentially enabling the use
of real documents or other configurations as defined by the
application logic.
Reformatted the `Transforms` sections in `yarp.json` to use
multi-line JSON objects instead of single-line objects.
This change improves the readability and maintainability
of the configuration file without altering its functionality.
The `Path` matching rule for the `receiver-ui-envelope` route was updated to use `/envelope/{EnvelopeKey}` instead of the wildcard `/envelope/{**catch-all}` for more specific routing.
Additionally, a `Transforms` section was added to the route, which includes a transformation to set the path to `/index.html`.
The `GetDocumentOfReceiver` method was introduced to handle
retrieving a document for a specified envelope key. It is
secured with the `[Authorize(Policy = AuthPolicy.Receiver)]`
attribute and responds to HTTP GET requests with a route
parameter `envelopeKey`.
The previous logic for extracting and validating the
`envelopeId` from user claims was removed. This was replaced
with a call to `User.GetEnvelopeIdOfReceiver()` for improved
clarity and maintainability.
The method uses the `mediator` to send a `ReadDocumentQuery`
and returns a `NotFound` response if the document's `ByteData`
is empty.
Refactor `ReceiverClaimExtensions` to support multiple claim
type variations by introducing arrays for envelope ID, UUID,
and receiver signature claim types. Updated the
`GetRequiredClaimOfReceiver` method to handle multiple claim
types and provide detailed error messages when claims are
missing. Refactored methods to use the new claim type arrays
for improved flexibility and robustness.