Updated `getSignatureNavState` to handle cases where the global signature list (`_allSignatures`) is unavailable or empty by introducing an early return with a default state.
Revised the logic to calculate `total`, `signed`, and `unsigned` using the global signature list, simplifying the `currentIndex` calculation to use the `signed` count. Updated `canGoPrev` and `canGoNext` to reflect the presence of signed or unsigned signatures.
Removed outdated logic relying on `signatureButtons` and added Turkish comments to clarify the new implementation.
Updated `COPILOT_CONTEXT_EN.md` to reflect the correct
coordinate system unit (INCHES) and added conversion
formulas for various systems. Corrected XML documentation
in `SignatureDto.cs`, `AnnotationDto.cs`, and
`AnnotationCreateDto.cs` to specify INCHES as the unit
and removed outdated references to DevExpress units.
Added `OPEN_TASK.md` to the solution file to track it
under `SolutionItems`. Removed incomplete task details
from `OPEN_TASK_SESSION_12.md`.
Provided additional context for future updates, including
database schema details and unit conversion references.
Documented completed changes for Session 12, such as
adding `SignatureService` to DI and fixing YARP routes.
The commit implements cross-page navigation for signatures in the `EnvelopeViewer.razor` component. Users can now navigate between signatures across pages using "Next Signature" and "Previous Signature" buttons.
Key changes:
- Fixed `getSignatureNavState()` to correctly calculate total, signed, and unsigned signatures globally.
- Updated `goToNextSignature()` to navigate to the next unsigned signature, including automatic page changes and scrolling.
- Updated `goToPreviousSignature()` to navigate to the last signed signature, including automatic page changes and scrolling.
- Ensured navigation buttons are properly disabled when no further navigation is possible.
The toolbar design remains unchanged, as requested. These changes address issues caused by a previous implementation that broke the counter and navigation functionality.
This commit introduces a signature navigation feature in the PDF viewer:
- Removed zoom preset buttons to make space for the new toolbar.
- Added "Previous" and "Next" buttons for navigating signatures.
- Displayed a signature counter with signed/total signatures and a badge for unsigned signatures or completion status.
- Introduced state variables (`_totalSignatures`, `_signedSignatures`, `_unsignedSignatures`) to track signature progress.
- Implemented methods for navigating signatures (`GoToPreviousSignature`, `GoToNextSignature`, `UpdateSignatureCounterAsync`).
- Enhanced JavaScript with `getSignatureNavState`, `goToNextSignature`, and `goToPreviousSignature` for navigation logic.
- Updated CSS for the toolbar and signature navigation, including responsive adjustments and hover effects.
- Improved error handling during signature counter updates.
- Updated `RenderSignatureButtonsAsync` to refresh the signature counter after rendering.
These changes improve the user experience by enabling efficient navigation and tracking of signatures in the PDF viewer.
Implemented a complete client-side workflow for creating, applying, and displaying visual signature overlays on the PDF canvas.
- Added "Unterschreiben" buttons with modern styling (purple gradient, hover effects) to apply signatures.
- Introduced a signature creation popup (DxPopup) with Draw, Text, and Image tabs, including validation for required fields (Name, Place).
- Rendered German-style signature overlays with image, separator line, and text (Name, Position, Place, Date in dd.MM.yyyy format).
- Ensured automatic re-rendering of overlays on page load, zoom, and page changes.
- Added `escapeHtml()` for XSS protection of user-provided text.
- Styled popup, canvas, and buttons with a modern, clean design.
- Suggested future enhancements for server-side stamping or integration with commercial PDF libraries.
Refactored `OnSignatureButtonClick` in `EnvelopeViewer.razor`:
- Converted to async and added null-check for `_capturedSignature`.
- Integrated `pdfViewer.applySignature` to apply signatures to PDFs.
Added `applySignature` method to `pdf-viewer.js`:
- Handles rendering of signatures with image, metadata, and styling.
- Follows German standards for signature formatting.
- Includes error handling for missing elements.
Introduced `escapeHtml` helper in `pdf-viewer.js` to prevent XSS.
Updated `MaxThumbnailWidth` in `EnvelopeViewer.razor` to 400.
Enhanced logging for better debugging during signature application.
Introduced a `DxPopup` for signature creation in `EnvelopeViewer.razor`, supporting three input methods: drawing, text, and image upload.
- Added `receiver-signature.js` for signature handling via JavaScript interop.
- Implemented tab-based UI for switching between signature methods.
- Added validation for required fields (e.g., full name, place).
- Enhanced text signature customization with font selection and dynamic rendering.
- Introduced state management for signature input and popup visibility.
- Added methods for initializing, clearing, and saving signatures.
- Styled the popup for a user-friendly experience and added error messages.
- Configured the popup to open automatically on page load or button click.
This feature improves the user experience by providing a flexible and intuitive way to create signatures.
The file `OPEN_TASK_SESSION_12.md` was removed from the
`SolutionItems` section of the `src` project in the
`EnvelopeGenerator.sln` solution file. This change ensures
that the file is no longer tracked as part of the solution.
Documented the new client-side signature overlay system for
EnvelopeViewer, replacing iText7 due to GPL license issues.
Outlined the signature data structure in C# and JavaScript,
and described the workflow steps for creating, applying,
and displaying signatures as visual overlays.
Added a "Future Enhancement Required" section suggesting
commercial PDF libraries or server-side stamping for future
improvements.
The text content of a `div` element in `pdf-viewer.js` was updated from "Sign" to "Unterschreiben" to support German localization. This change improves the user interface for German-speaking users by providing a translated label.
Implemented a new feature to render clickable "Sign" buttons on the PDF canvas at signature field positions fetched from the database.
- Updated `EnvelopeViewer.razor` to fetch signature data, convert coordinates from inches to points, and invoke JavaScript for rendering.
- Added `renderSignatureButtons` and `clearSignatureButtons` functions in `pdf-viewer.js` to dynamically create and position buttons based on page and zoom level.
- Modified HTML to include a new `#pdf-signature-layer` overlay for buttons.
- Styled buttons with a purple gradient, hover/active effects, and focus outlines for accessibility.
- Defined rendering triggers for initial load, page changes, and zoom changes.
- Documented coordinate conversion flow from inches to points to pixels for accurate positioning.
- Enhanced accessibility with `tabindex="0"`, focus outlines, and semantic `<button>` elements.
Introduced functionality to render interactive signature buttons on the PDF viewer. Added support for fetching and displaying signature data (`SignatureDto`) dynamically based on the current page.
- Added `@using` directives in `EnvelopeViewer.razor` for required namespaces.
- Introduced `_signatures` field to store signature data.
- Updated `OnInitializedAsync` to fetch and process signatures.
- Implemented `RenderSignatureButtonsAsync` to dynamically render buttons.
- Added `[JSInvokable]` method `OnSignatureButtonClick` for button events.
- Updated CSS to style `pdf-signature-layer` and `signature-button`.
- Enhanced `pdf-viewer.js` with methods to render and clear buttons.
- Ensured buttons respond to zoom and page navigation changes.
- Added error handling and logging for signature rendering.
These changes improve user interaction by enabling signing functionality directly on the PDF viewer.
Introduce a new static class `SignatureDtoExtensions` that adds
a `Convert<T>` extension method for collections of `SignatureDto`
objects. This method converts all `SignatureDto` instances in a
collection to a specified `UnitOfLength`, modifying them in place
and returning the same collection.
The method includes:
- A generic constraint to support any `IEnumerable<SignatureDto>`.
- Null checks to ensure the collection is not null.
- Comprehensive XML documentation with usage examples and notes.
Introduced the `UnitOfLength` enum to represent measurement units
(Inch and Point) for signature positioning, with detailed
documentation and conversion logic.
Updated `SignatureDto` to use `init` accessors for immutability,
added backing fields for `X` and `Y` with conversion support, and
introduced the `Factor` property to handle unit conversions.
Added a `Convert` method to enable switching between units of
length and improved extensibility for future `SenderAppType`
support. Enhanced code readability and maintainability with
detailed comments and remarks.
A new `SenderAppType` enum was introduced in the
`EnvelopeGenerator.ReceiverUI.Models.Constants` namespace, with
values `LegacyFormApp` and `ReceiverUIBlazorApp`.
The `SignatureDto` class was updated to include a new property of
type `SenderAppType`, enabling the specification of the sender
application type for a signature.
Additionally, a `using` directive for the
`EnvelopeGenerator.ReceiverUI.Models.Constants` namespace was added
to `SignatureDto.cs` to support the use of the new enum.
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.