CVNSS commited on
Commit
aef225a
·
verified ·
1 Parent(s): 4bd451d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +195 -99
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Thư Pháp Leonardo da Vinci</title>
7
  <!-- Import Renaissance & Royal Fonts -->
8
  <link href="https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=Pinyon+Script&family=Cinzel:wght@400;700&display=swap" rel="stylesheet">
9
 
@@ -13,15 +13,20 @@
13
 
14
  <style>
15
  :root {
16
- --paper-color: #e8dcc5; /* Màu giấy da dê (Vellum) đậm đà hơn */
17
- --ink-color: #2b1d0e; /* Mực nâu đen (Sepia đậm) */
18
- --gold-accent: #c5a059; /* Màu vàng kim loại */
19
- --border-color: #5c4033;
 
 
 
20
  }
21
 
22
  body {
23
- background-color: #1a1a1a;
24
- font-family: 'Segoe UI', sans-serif;
 
 
25
  display: flex;
26
  flex-direction: column;
27
  align-items: center;
@@ -29,179 +34,260 @@
29
  gap: 30px;
30
  margin: 0;
31
  color: #d4d4d4;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  h1 {
35
  color: var(--gold-accent);
36
- font-family: 'Cinzel', serif; /* Font tiêu đề phong cách La Mã cổ đại */
37
- font-size: 2.5rem;
38
  margin: 0;
39
- text-shadow: 0 2px 4px rgba(0,0,0,0.8);
40
- letter-spacing: 4px;
41
  text-transform: uppercase;
42
- border-bottom: 2px solid var(--gold-accent);
43
- padding-bottom: 10px;
44
  }
45
 
46
  .subtitle {
47
- color: #888;
48
  font-size: 0.9rem;
49
- margin-top: -10px;
50
  font-style: italic;
51
- font-family: 'Cinzel', serif;
52
  }
53
 
54
  /* --- CONTROLS SECTION --- */
55
  .controls {
56
  display: flex;
57
- gap: 15px;
58
  margin-bottom: 10px;
 
59
  }
60
 
61
  button {
62
- padding: 10px 20px;
63
- border: 1px solid var(--gold-accent);
64
- background: rgba(0,0,0,0.5);
65
  color: var(--gold-accent);
66
  font-family: 'Cinzel', serif;
67
  cursor: pointer;
68
  transition: all 0.3s ease;
69
  text-transform: uppercase;
70
- letter-spacing: 1px;
71
  font-size: 0.8rem;
 
 
 
72
  }
73
 
74
  button:hover {
75
- background: var(--gold-accent);
76
- color: #1a1a1a;
77
  box-shadow: 0 0 15px var(--gold-accent);
 
78
  }
79
 
80
  /* --- INPUT SECTION --- */
81
  .input-container {
82
- width: 700px;
83
- background: #2a2a2a;
84
- padding: 25px;
85
  border: 1px solid #444;
86
- box-shadow: 0 10px 25px rgba(0,0,0,0.5);
 
87
  display: flex;
88
  flex-direction: column;
89
  gap: 10px;
 
90
  }
91
 
92
  .input-container label {
93
- font-weight: bold;
94
- color: #aaa;
95
- text-transform: uppercase;
96
- font-size: 0.75rem;
97
  letter-spacing: 1px;
98
- font-family: 'Segoe UI', sans-serif;
99
  }
100
 
101
  textarea {
102
  width: 100%;
103
- height: 120px;
104
  padding: 15px;
105
- border: 1px solid #444;
106
- background-color: #1f1f1f;
107
  color: #e0e0e0;
108
  font-family: 'Segoe UI', sans-serif;
109
  font-size: 1rem;
110
  resize: vertical;
111
  box-sizing: border-box;
112
  line-height: 1.6;
 
113
  }
114
  textarea:focus {
115
  outline: none;
 
116
  border-color: var(--gold-accent);
117
  }
118
 
119
  /* --- LETTER STYLES --- */
 
 
 
 
 
 
 
 
120
  .letter-container {
121
  width: 800px;
122
  min-height: 1100px;
123
  background-color: var(--paper-color);
124
  position: relative;
125
- padding: 80px 90px;
126
  box-sizing: border-box;
127
- box-shadow: 0 20px 50px rgba(0,0,0,0.8);
128
 
129
- /* Texture giấy da kỹ (Parchment Texture) */
130
- background-image: url("data:image/svg+xml,%3Csvg width='300' height='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15' fill='%236b4c35'/%3E%3C/svg%3E");
 
 
 
 
131
  }
132
 
133
  /* Royal Border (Viền Hoàng Gia) */
134
- .letter-container::before {
135
- content: "";
136
  position: absolute;
137
- top: 20px; left: 20px; right: 20px; bottom: 20px;
138
  border: 2px solid #5c4033;
139
  pointer-events: none;
 
140
  }
141
- .letter-container::after {
142
- content: "";
143
  position: absolute;
144
- top: 25px; left: 25px; right: 25px; bottom: 25px;
145
- border: 1px solid var(--gold-accent);
146
  pointer-events: none;
 
147
  }
148
 
149
- /* Corner Ornaments (Họa tiết góc) - CSS thuần */
150
  .corner {
151
  position: absolute;
152
- width: 40px; height: 40px;
153
- border: 2px solid var(--gold-accent);
154
- z-index: 2;
 
 
 
 
 
 
 
 
 
155
  }
156
- .top-left { top: 15px; left: 15px; border-right: none; border-bottom: none; }
157
- .top-right { top: 15px; right: 15px; border-left: none; border-bottom: none; }
158
- .bottom-left { bottom: 15px; left: 15px; border-right: none; border-top: none; }
159
- .bottom-right { bottom: 15px; right: 15px; border-left: none; border-top: none; }
 
160
 
161
  .letter-content {
162
- /* Font Herr Von Muellerhoff rất giống chữ viết tay bay bổng thế kỷ 18 */
163
  font-family: 'Herr Von Muellerhoff', cursive;
164
  font-weight: 400;
165
- font-size: 3.2rem; /* Font này cần size rất to mới đọc được */
166
- line-height: 1.3;
167
  color: var(--ink-color);
168
  position: relative;
169
- z-index: 1;
170
  white-space: pre-wrap;
171
- text-align: left; /* Da Vinci thường viết kín trang */
172
 
173
- /* Hiệu ứng mực thấm nhẹ */
174
- text-shadow: 0 0 1px rgba(43, 29, 14, 0.2);
 
175
  }
176
 
177
- /* Drop Cap (Chữ cái đầu dòng lớn) */
178
  .letter-content::first-letter {
179
  font-family: 'Pinyon Script', cursive;
180
- font-size: 5rem;
181
  float: left;
182
- margin-right: 10px;
 
183
  line-height: 0.8;
184
- color: #5c4033;
185
- text-shadow: 1px 1px 0px var(--gold-accent);
186
  }
187
 
188
- /* Loading overlay for export */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  #loading {
190
  display: none;
191
  position: fixed;
192
  top: 0; left: 0; width: 100%; height: 100%;
193
- background: rgba(0,0,0,0.8);
194
  z-index: 999;
195
  color: var(--gold-accent);
196
  justify-content: center;
197
  align-items: center;
198
  flex-direction: column;
199
  font-family: 'Cinzel', serif;
 
200
  }
201
  .spinner {
202
- width: 40px; height: 40px;
203
- border: 4px solid var(--gold-accent);
204
- border-top: 4px solid transparent;
205
  border-radius: 50%;
206
  animation: spin 1s linear infinite;
207
  margin-bottom: 20px;
@@ -212,18 +298,20 @@
212
  </head>
213
  <body>
214
 
215
- <h1>Leonardo's Codex</h1>
216
- <div class="subtitle">Phong cách Hoàng Gia & Bút tích Da Vinci</div>
 
 
217
 
218
  <!-- EXPORT CONTROLS -->
219
  <div class="controls">
220
- <button onclick="exportJPG()">📸 Tải ảnh (JPG)</button>
221
- <button onclick="exportPDF()">📄 Tải tài liệu (PDF)</button>
222
  </div>
223
 
224
  <!-- INPUT SECTION -->
225
  <div class="input-container">
226
- <label for="letterInput">✎ Nội dung thư (Nhập vào đây):</label>
227
  <textarea id="letterInput" spellcheck="false">Hod Chij Mihp, wayl 12 thagj 12 namo 2025
228
 
229
  Thayd Bihl cihj menb,
@@ -248,20 +336,32 @@ Wylg Huzo L.AI</textarea>
248
  </div>
249
 
250
  <!-- LETTER DISPLAY -->
251
- <div id="capture-target" class="letter-container">
252
- <!-- Corner Ornaments -->
253
- <div class="corner top-left"></div>
254
- <div class="corner top-right"></div>
255
- <div class="corner bottom-left"></div>
256
- <div class="corner bottom-right"></div>
257
-
258
- <div class="letter-content"></div>
 
 
 
 
 
 
 
 
 
 
 
 
259
  </div>
260
 
261
  <!-- Loading Screen -->
262
  <div id="loading">
263
  <div class="spinner"></div>
264
- <div>Đang xử bút tích...</div>
265
  </div>
266
 
267
  <script>
@@ -290,12 +390,13 @@ Wylg Huzo L.AI</textarea>
290
  const canvas = await html2canvas(element, {
291
  scale: 2, // Tăng độ nét
292
  backgroundColor: null, // Giữ màu nền trong suốt nếu có
293
- useCORS: true
 
294
  });
295
 
296
  // Tải xuống
297
  const link = document.createElement('a');
298
- link.download = 'Thu_Phap_DaVinci.jpg';
299
  link.href = canvas.toDataURL('image/jpeg', 0.9);
300
  link.click();
301
  } catch (err) {
@@ -312,26 +413,21 @@ Wylg Huzo L.AI</textarea>
312
  // Tạo canvas trước
313
  const canvas = await html2canvas(element, {
314
  scale: 2,
315
- useCORS: true
 
316
  });
317
 
318
  const imgData = canvas.toDataURL('image/jpeg', 0.9);
319
  const { jsPDF } = window.jspdf;
320
 
321
- // Khổ A4 (210mm x 297mm) hoặc theo tỷ lệ ảnh
322
- // Ở đây ta dùng khổ tùy chỉnh theo kích thước ảnh để không bị cắt
323
- const imgWidth = 210; // mm (A4 width)
324
- const pageHeight = 297; // mm (A4 height)
325
- const imgHeight = canvas.height * imgWidth / canvas.width;
326
-
327
  const pdf = new jsPDF('p', 'mm', 'a4');
 
 
328
 
329
- // Nếu ảnh dài hơn A4, tự động chia trang hoặc co lại?
330
- // Ở đây ta co lại cho vừa 1 trang (fit to page) nếu cần, hoặc in dài
331
- // Để đơn giản cho thư tay, ta in 1 trang dài
332
-
333
  pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
334
- pdf.save('Thu_Phap_DaVinci.pdf');
335
  } catch (err) {
336
  console.error("Lỗi xuất PDF:", err);
337
  alert("Không thể xuất PDF. Vui lòng thử lại.");
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Thư Pháp Leonardo da Vinci - Royal Edition</title>
7
  <!-- Import Renaissance & Royal Fonts -->
8
  <link href="https://fonts.googleapis.com/css2?family=Herr+Von+Muellerhoff&family=Pinyon+Script&family=Cinzel:wght@400;700&display=swap" rel="stylesheet">
9
 
 
13
 
14
  <style>
15
  :root {
16
+ --paper-color: #f3e5ab; /* Màu giấy da dê sáng hơn, sang trọng hơn */
17
+ --paper-texture: #e6d69c;
18
+ --ink-color: #3b2518; /* Mực nâu đậm (Sepia) */
19
+ --gold-accent: #d4af37; /* Vàng kim loại chuẩn Royal */
20
+ --gold-dark: #aa8c2c;
21
+ --bg-color: #1a0f0a; /* Nền gỗ tối màu */
22
+ --red-seal: #8a1c1c; /* Màu sáp đỏ */
23
  }
24
 
25
  body {
26
+ background-color: var(--bg-color);
27
+ /* Họa tiết nền tối giản sang trọng */
28
+ background-image: radial-gradient(circle at center, #2a1f1a 0%, #0d0502 100%);
29
+ font-family: 'Cinzel', serif;
30
  display: flex;
31
  flex-direction: column;
32
  align-items: center;
 
34
  gap: 30px;
35
  margin: 0;
36
  color: #d4d4d4;
37
+ min-height: 100vh;
38
+ }
39
+
40
+ /* --- HEADER --- */
41
+ header {
42
+ text-align: center;
43
+ border-bottom: 1px solid var(--gold-dark);
44
+ padding-bottom: 20px;
45
+ width: 100%;
46
+ max-width: 800px;
47
+ position: relative;
48
+ }
49
+
50
+ header::after {
51
+ content: "♕";
52
+ display: block;
53
+ font-size: 2rem;
54
+ color: var(--gold-accent);
55
+ margin-top: 10px;
56
+ text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
57
  }
58
 
59
  h1 {
60
  color: var(--gold-accent);
61
+ font-size: 3rem;
 
62
  margin: 0;
63
+ text-shadow: 2px 2px 4px #000;
64
+ letter-spacing: 6px;
65
  text-transform: uppercase;
66
+ font-weight: 400;
 
67
  }
68
 
69
  .subtitle {
70
+ color: #8f8f8f;
71
  font-size: 0.9rem;
72
+ margin-top: 5px;
73
  font-style: italic;
74
+ letter-spacing: 2px;
75
  }
76
 
77
  /* --- CONTROLS SECTION --- */
78
  .controls {
79
  display: flex;
80
+ gap: 20px;
81
  margin-bottom: 10px;
82
+ z-index: 10;
83
  }
84
 
85
  button {
86
+ padding: 12px 25px;
87
+ border: 1px solid var(--gold-dark);
88
+ background: linear-gradient(180deg, #2b2b2b 0%, #1a1a1a 100%);
89
  color: var(--gold-accent);
90
  font-family: 'Cinzel', serif;
91
  cursor: pointer;
92
  transition: all 0.3s ease;
93
  text-transform: uppercase;
94
+ letter-spacing: 2px;
95
  font-size: 0.8rem;
96
+ font-weight: bold;
97
+ box-shadow: 0 4px 6px rgba(0,0,0,0.5);
98
+ border-radius: 2px;
99
  }
100
 
101
  button:hover {
102
+ background: linear-gradient(180deg, var(--gold-accent) 0%, var(--gold-dark) 100%);
103
+ color: #1a0f0a;
104
  box-shadow: 0 0 15px var(--gold-accent);
105
+ border-color: #fff;
106
  }
107
 
108
  /* --- INPUT SECTION --- */
109
  .input-container {
110
+ width: 800px;
111
+ background: rgba(30, 25, 20, 0.9);
112
+ padding: 20px;
113
  border: 1px solid #444;
114
+ border-top: 3px solid var(--gold-dark);
115
+ box-shadow: 0 10px 30px rgba(0,0,0,0.5);
116
  display: flex;
117
  flex-direction: column;
118
  gap: 10px;
119
+ box-sizing: border-box;
120
  }
121
 
122
  .input-container label {
123
+ color: var(--gold-accent);
124
+ font-size: 0.8rem;
 
 
125
  letter-spacing: 1px;
 
126
  }
127
 
128
  textarea {
129
  width: 100%;
130
+ height: 100px;
131
  padding: 15px;
132
+ border: 1px solid #333;
133
+ background-color: #121212;
134
  color: #e0e0e0;
135
  font-family: 'Segoe UI', sans-serif;
136
  font-size: 1rem;
137
  resize: vertical;
138
  box-sizing: border-box;
139
  line-height: 1.6;
140
+ border-left: 2px solid var(--gold-dark);
141
  }
142
  textarea:focus {
143
  outline: none;
144
+ background-color: #1a1a1a;
145
  border-color: var(--gold-accent);
146
  }
147
 
148
  /* --- LETTER STYLES --- */
149
+ .letter-wrapper {
150
+ position: relative;
151
+ padding: 20px;
152
+ background: #222; /* Bóng đổ giả lập mặt bàn */
153
+ box-shadow: 0 20px 50px rgba(0,0,0,0.9);
154
+ border-radius: 2px;
155
+ }
156
+
157
  .letter-container {
158
  width: 800px;
159
  min-height: 1100px;
160
  background-color: var(--paper-color);
161
  position: relative;
162
+ padding: 90px 100px;
163
  box-sizing: border-box;
164
+ overflow: hidden;
165
 
166
+ /* Texture giấy da cao cấp */
167
+ background-image:
168
+ url("data:image/svg+xml,%3Csvg width='300' height='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.12' fill='%238b5e3c'/%3E%3C/svg%3E"),
169
+ linear-gradient(to bottom right, rgba(255,255,255,0.4), rgba(0,0,0,0.1));
170
+
171
+ box-shadow: inset 0 0 80px rgba(60, 40, 20, 0.3); /* Vignette mép giấy */
172
  }
173
 
174
  /* Royal Border (Viền Hoàng Gia) */
175
+ .border-frame {
 
176
  position: absolute;
177
+ top: 25px; left: 25px; right: 25px; bottom: 25px;
178
  border: 2px solid #5c4033;
179
  pointer-events: none;
180
+ z-index: 2;
181
  }
182
+ .border-inner {
 
183
  position: absolute;
184
+ top: 32px; left: 32px; right: 32px; bottom: 32px;
185
+ border: 1px solid var(--gold-dark);
186
  pointer-events: none;
187
+ z-index: 2;
188
  }
189
 
190
+ /* Corner Ornaments */
191
  .corner {
192
  position: absolute;
193
+ width: 50px; height: 50px;
194
+ background-size: contain;
195
+ background-repeat: no-repeat;
196
+ opacity: 0.8;
197
+ z-index: 3;
198
+ }
199
+ /* Sử dụng CSS Gradient để vẽ hoa văn góc đơn giản */
200
+ .corner::before {
201
+ content: "";
202
+ position: absolute;
203
+ width: 100%; height: 100%;
204
+ border: 3px double var(--gold-dark);
205
  }
206
+ .top-left { top: 20px; left: 20px; border-right: none; border-bottom: none; }
207
+ .top-right { top: 20px; right: 20px; border-left: none; border-bottom: none; transform: rotate(90deg); }
208
+ .bottom-left { bottom: 20px; left: 20px; border-right: none; border-bottom: none; transform: rotate(-90deg); }
209
+ .bottom-right { bottom: 20px; right: 20px; border-left: none; border-bottom: none; transform: rotate(180deg); }
210
+
211
 
212
  .letter-content {
 
213
  font-family: 'Herr Von Muellerhoff', cursive;
214
  font-weight: 400;
215
+ font-size: 2.6rem;
216
+ line-height: 1.4;
217
  color: var(--ink-color);
218
  position: relative;
219
+ z-index: 5;
220
  white-space: pre-wrap;
221
+ text-align: justify;
222
 
223
+ /* Hiệu ứng mực loang nhẹ & không đều màu */
224
+ text-shadow: 0 0 1px rgba(59, 37, 24, 0.3);
225
+ filter: contrast(1.1);
226
  }
227
 
228
+ /* Drop Cap Royal */
229
  .letter-content::first-letter {
230
  font-family: 'Pinyon Script', cursive;
231
+ font-size: 6.5rem;
232
  float: left;
233
+ margin-right: 15px;
234
+ margin-top: -10px;
235
  line-height: 0.8;
236
+ color: var(--red-seal); /* Dropcap màu đỏ son */
237
+ text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
238
  }
239
 
240
+ /* Wax Seal (Con dấu sáp) */
241
+ .wax-seal {
242
+ position: absolute;
243
+ bottom: 60px;
244
+ right: 60px;
245
+ width: 120px;
246
+ height: 120px;
247
+ background: radial-gradient(circle at 30% 30%, #b03030, #8a1c1c, #520e0e);
248
+ border-radius: 50%;
249
+ box-shadow: 3px 3px 10px rgba(0,0,0,0.4), inset -2px -2px 10px rgba(0,0,0,0.3);
250
+ display: flex;
251
+ align-items: center;
252
+ justify-content: center;
253
+ color: rgba(0,0,0,0.3);
254
+ border: 4px dashed rgba(0,0,0,0.1);
255
+ z-index: 4;
256
+ transform: rotate(-15deg);
257
+ }
258
+ .wax-seal::after {
259
+ content: "ROYAL";
260
+ font-family: 'Cinzel', serif;
261
+ font-weight: 700;
262
+ font-size: 1.2rem;
263
+ color: rgba(255,255,255,0.2);
264
+ text-shadow: -1px -1px 0 rgba(0,0,0,0.3), 1px 1px 0 rgba(255,255,255,0.1);
265
+ }
266
+ .wax-inner-ring {
267
+ position: absolute;
268
+ width: 80%; height: 80%;
269
+ border: 2px solid rgba(0,0,0,0.2);
270
+ border-radius: 50%;
271
+ }
272
+
273
+ /* Loading overlay */
274
  #loading {
275
  display: none;
276
  position: fixed;
277
  top: 0; left: 0; width: 100%; height: 100%;
278
+ background: rgba(0,0,0,0.9);
279
  z-index: 999;
280
  color: var(--gold-accent);
281
  justify-content: center;
282
  align-items: center;
283
  flex-direction: column;
284
  font-family: 'Cinzel', serif;
285
+ letter-spacing: 2px;
286
  }
287
  .spinner {
288
+ width: 50px; height: 50px;
289
+ border: 3px solid rgba(212, 175, 55, 0.3);
290
+ border-top: 3px solid var(--gold-accent);
291
  border-radius: 50%;
292
  animation: spin 1s linear infinite;
293
  margin-bottom: 20px;
 
298
  </head>
299
  <body>
300
 
301
+ <header>
302
+ <h1>Leonardo's Codex</h1>
303
+ <div class="subtitle">Royal Edition • XVI Century Style</div>
304
+ </header>
305
 
306
  <!-- EXPORT CONTROLS -->
307
  <div class="controls">
308
+ <button onclick="exportJPG()">📸 Lưu Ảnh (JPG)</button>
309
+ <button onclick="exportPDF()">📜 Xuất Văn Bản (PDF)</button>
310
  </div>
311
 
312
  <!-- INPUT SECTION -->
313
  <div class="input-container">
314
+ <label for="letterInput">✎ Nội dung bút tích (Sẽ hiển thị tự động bên dưới):</label>
315
  <textarea id="letterInput" spellcheck="false">Hod Chij Mihp, wayl 12 thagj 12 namo 2025
316
 
317
  Thayd Bihl cihj menb,
 
336
  </div>
337
 
338
  <!-- LETTER DISPLAY -->
339
+ <div class="letter-wrapper">
340
+ <div id="capture-target" class="letter-container">
341
+ <!-- Borders -->
342
+ <div class="border-frame"></div>
343
+ <div class="border-inner"></div>
344
+
345
+ <!-- Corner Ornaments -->
346
+ <div class="corner top-left"></div>
347
+ <div class="corner top-right"></div>
348
+ <div class="corner bottom-left"></div>
349
+ <div class="corner bottom-right"></div>
350
+
351
+ <!-- Content -->
352
+ <div class="letter-content"></div>
353
+
354
+ <!-- Wax Seal -->
355
+ <div class="wax-seal">
356
+ <div class="wax-inner-ring"></div>
357
+ </div>
358
+ </div>
359
  </div>
360
 
361
  <!-- Loading Screen -->
362
  <div id="loading">
363
  <div class="spinner"></div>
364
+ <div>Đang niêm phong văn bản...</div>
365
  </div>
366
 
367
  <script>
 
390
  const canvas = await html2canvas(element, {
391
  scale: 2, // Tăng độ nét
392
  backgroundColor: null, // Giữ màu nền trong suốt nếu có
393
+ useCORS: true,
394
+ logging: false
395
  });
396
 
397
  // Tải xuống
398
  const link = document.createElement('a');
399
+ link.download = 'Hoang_Gia_DaVinci.jpg';
400
  link.href = canvas.toDataURL('image/jpeg', 0.9);
401
  link.click();
402
  } catch (err) {
 
413
  // Tạo canvas trước
414
  const canvas = await html2canvas(element, {
415
  scale: 2,
416
+ useCORS: true,
417
+ logging: false
418
  });
419
 
420
  const imgData = canvas.toDataURL('image/jpeg', 0.9);
421
  const { jsPDF } = window.jspdf;
422
 
423
+ // Khổ A4 (210mm x 297mm)
 
 
 
 
 
424
  const pdf = new jsPDF('p', 'mm', 'a4');
425
+ const imgWidth = 210;
426
+ const imgHeight = canvas.height * imgWidth / canvas.width;
427
 
428
+ // Căn chỉnh nếu dài quá khổ A4 thì in trang dài hoặc fit
 
 
 
429
  pdf.addImage(imgData, 'JPEG', 0, 0, imgWidth, imgHeight);
430
+ pdf.save('Hoang_Gia_DaVinci.pdf');
431
  } catch (err) {
432
  console.error("Lỗi xuất PDF:", err);
433
  alert("Không thể xuất PDF. Vui lòng thử lại.");