-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathannotator.html
More file actions
200 lines (181 loc) · 8.99 KB
/
Copy pathannotator.html
File metadata and controls
200 lines (181 loc) · 8.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rashid-PDF-Editor</title>
<link rel="stylesheet" href="annotator.css">
</head>
<body>
<!-- Top Bar -->
<div id="topbar">
<div class="topbar-left">
<div class="logo">
<span class="logo-dot"></span>
Rashid-PDF-Editor
</div>
<div class="page-controls">
<button id="prev-page" title="Previous Page">‹</button>
<span id="page-display">Page <span id="page-num">1</span> / <span id="page-count">—</span></span>
<button id="next-page" title="Next Page">›</button>
</div>
<div class="zoom-controls">
<button id="zoom-out" title="Zoom Out">−</button>
<span id="zoom-display">100%</span>
<button id="zoom-in" title="Zoom In">+</button>
<button id="zoom-fit" title="Fit Page">⊡</button>
</div>
</div>
<div class="topbar-right">
<button class="btn-save" id="save-btn" title="Save / Download flattened PDF">
⬇ Save PDF
</button>
</div>
</div>
<!-- Toolbar -->
<div id="toolbar">
<div class="tool-section">
<div class="tool-label">SELECT</div>
<button class="tool-btn active" data-tool="select" title="Select / Move / Resize">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 3l14 9-7 1-4 7z"/></svg>
</button>
</div>
<div class="tool-divider"></div>
<div class="tool-section">
<div class="tool-label">DRAW</div>
<button class="tool-btn" data-tool="pen" title="Freehand Draw">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/><circle cx="11" cy="11" r="2"/></svg>
</button>
<button class="tool-btn" data-tool="highlight" title="Highlight">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 11l-4 4 2 2 4-4"/><path d="M18 4l-8.5 8.5"/><path d="M14 7l3 3"/></svg>
</button>
<button class="tool-btn" data-tool="eraser" title="Eraser">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 20H7L3 16l10-10 7 7z"/><path d="M6.5 17.5l5-5"/></svg>
</button>
</div>
<div class="tool-divider"></div>
<div class="tool-section">
<div class="tool-label">TEXT</div>
<button class="tool-btn" data-tool="text" title="Add Text">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/></svg>
</button>
</div>
<div class="tool-divider"></div>
<div class="tool-section">
<div class="tool-label">SHAPES</div>
<button class="tool-btn" data-tool="rect" title="Rectangle">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>
</button>
<button class="tool-btn" data-tool="circle" title="Circle">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg>
</button>
<button class="tool-btn" data-tool="ellipse" title="Ellipse">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="12" cy="12" rx="10" ry="6"/></svg>
</button>
<button class="tool-btn" data-tool="line" title="Line">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="19" x2="19" y2="5"/></svg>
</button>
<button class="tool-btn" data-tool="arrow" title="Arrow">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="19" x2="19" y2="5"/><polyline points="9 5 19 5 19 15"/></svg>
</button>
</div>
<div class="tool-divider"></div>
<div class="tool-section">
<div class="tool-label">SIGN</div>
<button class="tool-btn" data-tool="signature" title="Draw Signature">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 17c3-3 7-7 8-7s2 4 4 4 2-3 3-3 1 1 2 1"/><path d="M19 17l1 1"/></svg>
</button>
<button class="tool-btn" id="sig-upload-btn" data-tool="sig-image" title="Upload Signature Image">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>
</button>
<input type="file" id="sig-image-input" accept="image/*" style="display:none">
</div>
<div class="tool-divider"></div>
<!-- Color & Style -->
<div class="tool-section style-section">
<div class="tool-label">STYLE</div>
<div class="color-row">
<div class="color-swatch active" style="background:#ff5f3f" data-color="#ff5f3f"></div>
<div class="color-swatch" style="background:#ffd600" data-color="#ffd600"></div>
<div class="color-swatch" style="background:#00c896" data-color="#00c896"></div>
<div class="color-swatch" style="background:#4a90ff" data-color="#4a90ff"></div>
<div class="color-swatch" style="background:#b34fff" data-color="#b34fff"></div>
<div class="color-swatch" style="background:#1a1a1a" data-color="#1a1a1a"></div>
<div class="color-swatch" style="background:#fff;border:1px solid #ccc" data-color="#ffffff"></div>
<input type="color" id="custom-color" value="#ff5f3f" title="Custom color">
</div>
<div class="stroke-row">
<label style="font-size:10px;color:#aeaeb2;letter-spacing:1px;">SIZE</label>
<input type="range" id="stroke-size" min="1" max="30" value="3">
<span id="stroke-size-val">3</span>
</div>
<div class="opacity-row">
<label style="font-size:10px;color:#aeaeb2;letter-spacing:1px;">OPACITY</label>
<input type="range" id="opacity-slider" min="10" max="100" value="100">
<span id="opacity-val">100%</span>
</div>
<div class="fill-row">
<label class="checkbox-label">
<input type="checkbox" id="fill-shape"> Fill shape
</label>
</div>
</div>
<div class="tool-divider"></div>
<div class="tool-section">
<div class="tool-label">EDIT</div>
<button class="tool-btn" id="undo-btn" title="Undo (Ctrl+Z)">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 7v6h6"/><path d="M3 13C5 7 10 4 16 6c3.5 1 6 3.5 6 8"/></svg>
</button>
<button class="tool-btn" id="redo-btn" title="Redo (Ctrl+Y)">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 7v6h-6"/><path d="M21 13c-2-6-7-9-13-7C4.5 7 2 9.5 2 14"/></svg>
</button>
<button class="tool-btn danger" id="clear-btn" title="Clear all annotations on this page">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6"/><path d="M10 11v6M14 11v6"/></svg>
</button>
</div>
</div>
<!-- Main Area -->
<div id="main-area">
<!-- Loading overlay -->
<div id="loading-overlay">
<div class="loading-content">
<div class="spinner"></div>
<div class="loading-text">Loading PDF…</div>
</div>
</div>
<!-- PDF Viewer -->
<div id="pdf-container">
<div id="pdf-canvas-wrapper">
<canvas id="pdf-canvas"></canvas>
<canvas id="annotation-canvas"></canvas>
</div>
</div>
<!-- Text input overlay -->
<div id="text-input-overlay" style="display:none">
<textarea id="text-input-field" placeholder="Type here…"></textarea>
<div class="text-input-btns">
<button id="text-confirm">Add</button>
<button id="text-cancel">Cancel</button>
</div>
</div>
</div>
<!-- Resize hint -->
<div class="resize-hint" id="resize-hint">Drag handles to resize · Drag body to move · Delete to remove</div>
<!-- Signature modal -->
<div id="sig-modal" style="display:none">
<div class="sig-modal-inner">
<div class="sig-modal-title">Draw Your Signature</div>
<canvas id="sig-canvas"></canvas>
<div class="sig-modal-btns">
<button id="sig-clear">Clear</button>
<button id="sig-cancel">Cancel</button>
<button id="sig-confirm" class="primary">Place Signature</button>
</div>
</div>
</div>
<!-- Scripts -->
<script src="lib/pdf.min.js"></script>
<script src="lib/pdf-lib.min.js"></script>
<script src="annotator.js"></script>
</body>
</html>