Add text layer support for PDF rendering and selection
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.
This commit is contained in:
@@ -434,9 +434,14 @@ body.resizing {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.pdf-canvas {
|
||||
.pdf-page-container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.pdf-canvas {
|
||||
display: block;
|
||||
vertical-align: top;
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
image-rendering: crisp-edges;
|
||||
@@ -447,6 +452,34 @@ body.resizing {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.pdf-text-layer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
opacity: 1;
|
||||
line-height: 1.0;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.pdf-text-layer > span {
|
||||
color: transparent;
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
cursor: text;
|
||||
transform-origin: 0% 0%;
|
||||
}
|
||||
|
||||
.pdf-text-layer ::selection {
|
||||
background: rgba(126, 34, 206, 0.3);
|
||||
}
|
||||
|
||||
.pdf-text-layer ::-moz-selection {
|
||||
background: rgba(126, 34, 206, 0.3);
|
||||
}
|
||||
|
||||
.error-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user