Update index.html
Browse files- index.html +79 -144
index.html
CHANGED
|
@@ -16,121 +16,93 @@
|
|
| 16 |
<div class="logo-circle">P</div>
|
| 17 |
<div class="brand-text">
|
| 18 |
<div class="brand-title">stat2025 PDF Studio</div>
|
| 19 |
-
<div class="brand-sub">تحويل
|
| 20 |
</div>
|
| 21 |
</div>
|
| 22 |
<nav class="nav">
|
| 23 |
-
<
|
| 24 |
-
<
|
| 25 |
</nav>
|
| 26 |
</header>
|
| 27 |
|
| 28 |
-
<!--
|
| 29 |
<main class="main">
|
| 30 |
-
|
| 31 |
<section class="hero">
|
| 32 |
-
<h1>
|
| 33 |
<p>
|
| 34 |
-
|
| 35 |
-
جميع العمليات تتم
|
| 36 |
</p>
|
| 37 |
</section>
|
| 38 |
|
| 39 |
-
<!-- خطوات
|
| 40 |
<section class="steps">
|
| 41 |
<div class="step">
|
| 42 |
<div class="step-number">1</div>
|
| 43 |
-
<div class="step-text">اختر
|
| 44 |
</div>
|
| 45 |
<div class="step">
|
| 46 |
<div class="step-number">2</div>
|
| 47 |
-
<div class="step-text">
|
| 48 |
</div>
|
| 49 |
<div class="step">
|
| 50 |
<div class="step-number">3</div>
|
| 51 |
-
<div class="step-text">ا
|
| 52 |
</div>
|
| 53 |
</section>
|
| 54 |
|
| 55 |
-
<!-- كرت ال
|
| 56 |
<section class="card main-card">
|
| 57 |
-
<!-- نوع الملفات -->
|
| 58 |
-
<div class="card-row">
|
| 59 |
-
<h2 class="card-title">نوع الملفات</h2>
|
| 60 |
-
<div class="options">
|
| 61 |
-
<label class="option-pill">
|
| 62 |
-
<input type="radio" name="fileType" value="images" checked />
|
| 63 |
-
<span>صور ➜ PDF واحد</span>
|
| 64 |
-
</label>
|
| 65 |
-
<label class="option-pill">
|
| 66 |
-
<input type="radio" name="fileType" value="pdfs" />
|
| 67 |
-
<span>دمج ملفات PDF متعددة</span>
|
| 68 |
-
</label>
|
| 69 |
-
</div>
|
| 70 |
-
</div>
|
| 71 |
|
| 72 |
-
<!--
|
| 73 |
<div class="card-row">
|
| 74 |
<h2 class="card-title">اختيار الملفات</h2>
|
| 75 |
-
|
| 76 |
-
<div id="dropzone" class="dropzone">
|
| 77 |
-
<div class="dropzone-icon">
|
| 78 |
-
<!-- أيقونة بسيطة -->
|
| 79 |
-
<svg viewBox="0 0 24 24" aria-hidden="true">
|
| 80 |
-
<path d="M12 2L7 7h3v6h4V7h3L12 2zM5 15h14v5H5z"/>
|
| 81 |
-
</svg>
|
| 82 |
-
</div>
|
| 83 |
-
<div class="dropzone-text">
|
| 84 |
-
اسحب الملفات إلى هنا
|
| 85 |
-
<span>أو اضغط للاختيار من جهازك</span>
|
| 86 |
-
</div>
|
| 87 |
-
<input id="files" type="file" multiple />
|
| 88 |
-
</div>
|
| 89 |
-
|
| 90 |
<p class="hint">
|
| 91 |
-
|
| 92 |
-
ل
|
| 93 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
</div>
|
| 95 |
|
| 96 |
-
<!-- قائمة الملفات
|
| 97 |
<div id="fileList" class="file-list hidden"></div>
|
| 98 |
|
| 99 |
-
<!-- اسم
|
| 100 |
<div class="card-row inline">
|
| 101 |
<label for="outputName" class="card-title small">اسم ملف الإخراج (اختياري)</label>
|
| 102 |
<input id="outputName" type="text" class="output-input"
|
| 103 |
-
placeholder="مثال:
|
| 104 |
</div>
|
| 105 |
|
| 106 |
-
<!-- زر ال
|
| 107 |
<div class="actions">
|
| 108 |
-
<button id="mergeBtn" class="btn-main">
|
| 109 |
-
دمج وإنشاء ملف PDF
|
| 110 |
-
</button>
|
| 111 |
</div>
|
| 112 |
|
| 113 |
-
<!-- حالة
|
| 114 |
<div id="status" class="status"></div>
|
| 115 |
</section>
|
| 116 |
|
| 117 |
-
<!--
|
| 118 |
<section class="privacy">
|
| 119 |
-
<h3>الخصوصية
|
| 120 |
<p>
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
</p>
|
| 125 |
</section>
|
| 126 |
-
|
| 127 |
</main>
|
| 128 |
|
| 129 |
<!-- تذييل -->
|
| 130 |
<footer class="footer">
|
| 131 |
<span>stat2025 • PDF Tools</span>
|
| 132 |
<span class="dot">•</span>
|
| 133 |
-
<span>
|
| 134 |
</footer>
|
| 135 |
|
| 136 |
</div>
|
|
@@ -140,20 +112,14 @@
|
|
| 140 |
const mergeBtn = document.getElementById("mergeBtn");
|
| 141 |
const statusDiv = document.getElementById("status");
|
| 142 |
const fileListDiv = document.getElementById("fileList");
|
| 143 |
-
const dropzone = document.getElementById("dropzone");
|
| 144 |
const outputNameInput = document.getElementById("outputName");
|
| 145 |
|
| 146 |
-
function setStatus(msg, type = "
|
| 147 |
statusDiv.textContent = msg;
|
| 148 |
-
statusDiv.className = "status " + type;
|
| 149 |
if (!msg) statusDiv.className = "status";
|
| 150 |
}
|
| 151 |
|
| 152 |
-
function getSelectedType() {
|
| 153 |
-
const checked = document.querySelector('input[name="fileType"]:checked');
|
| 154 |
-
return checked ? checked.value : null;
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
function renderFileList(files) {
|
| 158 |
if (!files.length) {
|
| 159 |
fileListDiv.classList.add("hidden");
|
|
@@ -164,19 +130,36 @@
|
|
| 164 |
fileListDiv.innerHTML = `
|
| 165 |
<div class="file-list-header">
|
| 166 |
<span>الملفات المختارة (${files.length})</span>
|
| 167 |
-
<span class="file-note">يتم الدمج حسب الترتيب الأبجدي لاسم الملف.</span>
|
| 168 |
</div>
|
| 169 |
<ul class="file-list-ul">
|
| 170 |
${files
|
| 171 |
.map(
|
| 172 |
-
(f, i) =>
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
)
|
| 175 |
.join("")}
|
| 176 |
</ul>
|
| 177 |
`;
|
| 178 |
}
|
| 179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
function downloadPdf(bytes, filename) {
|
| 181 |
const blob = new Blob([bytes], { type: "application/pdf" });
|
| 182 |
const url = URL.createObjectURL(blob);
|
|
@@ -189,88 +172,49 @@
|
|
| 189 |
URL.revokeObjectURL(url);
|
| 190 |
}
|
| 191 |
|
| 192 |
-
function getFilesArray() {
|
| 193 |
-
return Array.from(filesInput.files || []);
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
// تعامل مع السحب والإفلات
|
| 197 |
-
dropzone.addEventListener("click", () => filesInput.click());
|
| 198 |
-
|
| 199 |
-
;["dragenter", "dragover"].forEach(evtName => {
|
| 200 |
-
dropzone.addEventListener(evtName, e => {
|
| 201 |
-
e.preventDefault();
|
| 202 |
-
e.stopPropagation();
|
| 203 |
-
dropzone.classList.add("hover");
|
| 204 |
-
});
|
| 205 |
-
});
|
| 206 |
-
|
| 207 |
-
;["dragleave", "drop"].forEach(evtName => {
|
| 208 |
-
dropzone.addEventListener(evtName, e => {
|
| 209 |
-
e.preventDefault();
|
| 210 |
-
e.stopPropagation();
|
| 211 |
-
if (evtName !== "drop") dropzone.classList.remove("hover");
|
| 212 |
-
});
|
| 213 |
-
});
|
| 214 |
-
|
| 215 |
-
dropzone.addEventListener("drop", e => {
|
| 216 |
-
dropzone.classList.remove("hover");
|
| 217 |
-
const dtFiles = Array.from(e.dataTransfer.files || []);
|
| 218 |
-
if (dtFiles.length) {
|
| 219 |
-
// نحتاج لإنشاء FileList جديدة: نستخدم DataTransfer
|
| 220 |
-
const dataTransfer = new DataTransfer();
|
| 221 |
-
dtFiles.forEach(f => dataTransfer.items.add(f));
|
| 222 |
-
filesInput.files = dataTransfer.files;
|
| 223 |
-
renderFileList(getFilesArray());
|
| 224 |
-
setStatus("");
|
| 225 |
-
}
|
| 226 |
-
});
|
| 227 |
-
|
| 228 |
-
// تحديث القائمة عند اختيار ملفات
|
| 229 |
filesInput.addEventListener("change", () => {
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
| 231 |
setStatus("");
|
| 232 |
});
|
| 233 |
|
| 234 |
mergeBtn.addEventListener("click", async () => {
|
| 235 |
-
|
| 236 |
-
let files = getFilesArray();
|
| 237 |
-
|
| 238 |
-
if (!selectedType) {
|
| 239 |
-
setStatus("الرجاء اختيار نوع الملفات أولاً.", "error");
|
| 240 |
-
return;
|
| 241 |
-
}
|
| 242 |
|
| 243 |
if (!files.length) {
|
| 244 |
-
setStatus("الرجاء اختيار الملفات
|
| 245 |
return;
|
| 246 |
}
|
| 247 |
|
| 248 |
-
// ترتيب حسب الاسم
|
| 249 |
files = files.sort((a, b) =>
|
| 250 |
a.name.localeCompare(b.name, undefined, { numeric: true })
|
| 251 |
);
|
| 252 |
-
|
| 253 |
renderFileList(files);
|
| 254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
try {
|
| 256 |
setStatus("جاري معالجة الملفات... لا تُغلق الصفحة.", "loading");
|
| 257 |
mergeBtn.disabled = true;
|
| 258 |
mergeBtn.classList.add("disabled");
|
| 259 |
|
| 260 |
-
if (
|
| 261 |
-
if (!files.every(f => f.type.startsWith("image/"))) {
|
| 262 |
-
setStatus("عند اختيار (صور ➜ PDF) يجب أن تكون جميع الملفات صورًا.", "error");
|
| 263 |
-
mergeBtn.disabled = false;
|
| 264 |
-
mergeBtn.classList.remove("disabled");
|
| 265 |
-
return;
|
| 266 |
-
}
|
| 267 |
-
|
| 268 |
const pdfDoc = await PDFLib.PDFDocument.create();
|
| 269 |
|
| 270 |
for (const file of files) {
|
| 271 |
const bytes = await file.arrayBuffer();
|
| 272 |
-
let image;
|
| 273 |
const lower = file.name.toLowerCase();
|
|
|
|
| 274 |
|
| 275 |
if (
|
| 276 |
file.type === "image/jpeg" ||
|
|
@@ -300,25 +244,14 @@
|
|
| 300 |
}
|
| 301 |
|
| 302 |
const pdfBytes = await pdfDoc.save();
|
| 303 |
-
const outName =
|
|
|
|
|
|
|
| 304 |
downloadPdf(pdfBytes, outName);
|
| 305 |
setStatus("تم إنشاء ملف PDF من الصور وتحميله بنجاح. ✅", "ok");
|
| 306 |
}
|
| 307 |
|
| 308 |
-
if (
|
| 309 |
-
if (
|
| 310 |
-
!files.every(
|
| 311 |
-
f =>
|
| 312 |
-
f.type === "application/pdf" ||
|
| 313 |
-
f.name.toLowerCase().endsWith(".pdf")
|
| 314 |
-
)
|
| 315 |
-
) {
|
| 316 |
-
setStatus("عند اختيار (دمج PDF) يجب أن تكون جميع الملفات بصيغة PDF.", "error");
|
| 317 |
-
mergeBtn.disabled = false;
|
| 318 |
-
mergeBtn.classList.remove("disabled");
|
| 319 |
-
return;
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
const pdfDoc = await PDFLib.PDFDocument.create();
|
| 323 |
|
| 324 |
for (const file of files) {
|
|
@@ -332,7 +265,9 @@
|
|
| 332 |
}
|
| 333 |
|
| 334 |
const pdfBytes = await pdfDoc.save();
|
| 335 |
-
const outName =
|
|
|
|
|
|
|
| 336 |
downloadPdf(pdfBytes, outName);
|
| 337 |
setStatus("تم دمج ملفات PDF وتحميل الملف النهائي. ✅", "ok");
|
| 338 |
}
|
|
|
|
| 16 |
<div class="logo-circle">P</div>
|
| 17 |
<div class="brand-text">
|
| 18 |
<div class="brand-title">stat2025 PDF Studio</div>
|
| 19 |
+
<div class="brand-sub">دمج وتحويل آمن داخل متصفحك</div>
|
| 20 |
</div>
|
| 21 |
</div>
|
| 22 |
<nav class="nav">
|
| 23 |
+
<span class="nav-link active">الرئيسية</span>
|
| 24 |
+
<span class="nav-link muted">لا يتم تخزين أي ملفات</span>
|
| 25 |
</nav>
|
| 26 |
</header>
|
| 27 |
|
| 28 |
+
<!-- مقدمة -->
|
| 29 |
<main class="main">
|
|
|
|
| 30 |
<section class="hero">
|
| 31 |
+
<h1>اختر ملفاتك، ودع الأداة تنشئ لك ملف PDF واحد بسهولة.</h1>
|
| 32 |
<p>
|
| 33 |
+
يدعم دمج عدة ملفات PDF في ملف واحد، أو تحويل مجموعة صور (JPG/PNG) إلى PDF.
|
| 34 |
+
جميع العمليات تتم محليًا على جهازك دون رفع أي ملف للخادم.
|
| 35 |
</p>
|
| 36 |
</section>
|
| 37 |
|
| 38 |
+
<!-- خطوات مبسطة -->
|
| 39 |
<section class="steps">
|
| 40 |
<div class="step">
|
| 41 |
<div class="step-number">1</div>
|
| 42 |
+
<div class="step-text">اضغط زر اختيار الملفات وحدد الصور أو ملفات PDF.</div>
|
| 43 |
</div>
|
| 44 |
<div class="step">
|
| 45 |
<div class="step-number">2</div>
|
| 46 |
+
<div class="step-text">النظام يتعرف تلقائيًا: صور أو PDF فقط.</div>
|
| 47 |
</div>
|
| 48 |
<div class="step">
|
| 49 |
<div class="step-number">3</div>
|
| 50 |
+
<div class="step-text">احصل على ملف PDF واحد جاهز للتحميل.</div>
|
| 51 |
</div>
|
| 52 |
</section>
|
| 53 |
|
| 54 |
+
<!-- الكرت الرئيسي -->
|
| 55 |
<section class="card main-card">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
<!-- اختيار الملفات -->
|
| 58 |
<div class="card-row">
|
| 59 |
<h2 class="card-title">اختيار الملفات</h2>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
<p class="hint">
|
| 61 |
+
يمكنك اختيار عدة صور <b>(JPG / PNG)</b> أو عدة ملفات <b>PDF</b>.
|
| 62 |
+
لا تخلط بين النوعين في نفس العملية.
|
| 63 |
</p>
|
| 64 |
+
|
| 65 |
+
<label class="file-picker">
|
| 66 |
+
<span class="file-picker-label">اختر الملفات من جهازك</span>
|
| 67 |
+
<input id="files" type="file" multiple accept=".pdf,image/*" />
|
| 68 |
+
</label>
|
| 69 |
</div>
|
| 70 |
|
| 71 |
+
<!-- قائمة الملفات -->
|
| 72 |
<div id="fileList" class="file-list hidden"></div>
|
| 73 |
|
| 74 |
+
<!-- اسم ملف الإخراج (اختياري) -->
|
| 75 |
<div class="card-row inline">
|
| 76 |
<label for="outputName" class="card-title small">اسم ملف الإخراج (اختياري)</label>
|
| 77 |
<input id="outputName" type="text" class="output-input"
|
| 78 |
+
placeholder="مثال: merged.pdf" />
|
| 79 |
</div>
|
| 80 |
|
| 81 |
+
<!-- زر الدمج -->
|
| 82 |
<div class="actions">
|
| 83 |
+
<button id="mergeBtn" class="btn-main">دمج وإنشاء ملف PDF واحد</button>
|
|
|
|
|
|
|
| 84 |
</div>
|
| 85 |
|
| 86 |
+
<!-- حالة -->
|
| 87 |
<div id="status" class="status"></div>
|
| 88 |
</section>
|
| 89 |
|
| 90 |
+
<!-- الخصوصية -->
|
| 91 |
<section class="privacy">
|
| 92 |
+
<h3>الخصوصية</h3>
|
| 93 |
<p>
|
| 94 |
+
• تتم المعالجة باستخدام JavaScript داخل المتصفح فقط.<br>
|
| 95 |
+
• لا يتم رفع أو حفظ أي ملف في خوادم stat2025 أو Hugging Face.<br>
|
| 96 |
+
• يمكنك إغلاق الصفحة في أي وقت دون أي أثر لملفاتك.
|
| 97 |
</p>
|
| 98 |
</section>
|
|
|
|
| 99 |
</main>
|
| 100 |
|
| 101 |
<!-- تذييل -->
|
| 102 |
<footer class="footer">
|
| 103 |
<span>stat2025 • PDF Tools</span>
|
| 104 |
<span class="dot">•</span>
|
| 105 |
+
<span>تصميم وإعداد الدعم الفني: نوف الناصر</span>
|
| 106 |
</footer>
|
| 107 |
|
| 108 |
</div>
|
|
|
|
| 112 |
const mergeBtn = document.getElementById("mergeBtn");
|
| 113 |
const statusDiv = document.getElementById("status");
|
| 114 |
const fileListDiv = document.getElementById("fileList");
|
|
|
|
| 115 |
const outputNameInput = document.getElementById("outputName");
|
| 116 |
|
| 117 |
+
function setStatus(msg, type = "") {
|
| 118 |
statusDiv.textContent = msg;
|
| 119 |
+
statusDiv.className = "status" + (type ? " " + type : "");
|
| 120 |
if (!msg) statusDiv.className = "status";
|
| 121 |
}
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
function renderFileList(files) {
|
| 124 |
if (!files.length) {
|
| 125 |
fileListDiv.classList.add("hidden");
|
|
|
|
| 130 |
fileListDiv.innerHTML = `
|
| 131 |
<div class="file-list-header">
|
| 132 |
<span>الملفات المختارة (${files.length})</span>
|
| 133 |
+
<span class="file-note">سيتم الدمج حسب الترتيب الأبجدي لاسم الملف.</span>
|
| 134 |
</div>
|
| 135 |
<ul class="file-list-ul">
|
| 136 |
${files
|
| 137 |
.map(
|
| 138 |
+
(f, i) => `
|
| 139 |
+
<li>
|
| 140 |
+
<span class="index">${i + 1}</span>
|
| 141 |
+
<span class="name">${f.name}</span>
|
| 142 |
+
<span class="size">${(f.size / 1024).toFixed(1)} كيلوبايت</span>
|
| 143 |
+
</li>`
|
| 144 |
)
|
| 145 |
.join("")}
|
| 146 |
</ul>
|
| 147 |
`;
|
| 148 |
}
|
| 149 |
|
| 150 |
+
function detectMode(files) {
|
| 151 |
+
const allImages = files.every(f => f.type.startsWith("image/"));
|
| 152 |
+
const allPDFs =
|
| 153 |
+
files.every(
|
| 154 |
+
f =>
|
| 155 |
+
f.type === "application/pdf" ||
|
| 156 |
+
f.name.toLowerCase().endsWith(".pdf")
|
| 157 |
+
);
|
| 158 |
+
if (allImages) return "images";
|
| 159 |
+
if (allPDFs) return "pdfs";
|
| 160 |
+
return null;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
function downloadPdf(bytes, filename) {
|
| 164 |
const blob = new Blob([bytes], { type: "application/pdf" });
|
| 165 |
const url = URL.createObjectURL(blob);
|
|
|
|
| 172 |
URL.revokeObjectURL(url);
|
| 173 |
}
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
filesInput.addEventListener("change", () => {
|
| 176 |
+
const files = Array.from(filesInput.files || []).sort((a, b) =>
|
| 177 |
+
a.name.localeCompare(b.name, undefined, { numeric: true })
|
| 178 |
+
);
|
| 179 |
+
renderFileList(files);
|
| 180 |
setStatus("");
|
| 181 |
});
|
| 182 |
|
| 183 |
mergeBtn.addEventListener("click", async () => {
|
| 184 |
+
let files = Array.from(filesInput.files || []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
if (!files.length) {
|
| 187 |
+
setStatus("الرجاء اختيار الملفات أولاً.", "error");
|
| 188 |
return;
|
| 189 |
}
|
| 190 |
|
| 191 |
+
// ترتيب حسب الاسم للحفاظ على التسلسل
|
| 192 |
files = files.sort((a, b) =>
|
| 193 |
a.name.localeCompare(b.name, undefined, { numeric: true })
|
| 194 |
);
|
|
|
|
| 195 |
renderFileList(files);
|
| 196 |
|
| 197 |
+
const mode = detectMode(files);
|
| 198 |
+
if (!mode) {
|
| 199 |
+
setStatus(
|
| 200 |
+
"يجب أن تكون جميع الملفات صورًا فقط أو جميعها PDF فقط. لا يمكن خلط النوعين.",
|
| 201 |
+
"error"
|
| 202 |
+
);
|
| 203 |
+
return;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
try {
|
| 207 |
setStatus("جاري معالجة الملفات... لا تُغلق الصفحة.", "loading");
|
| 208 |
mergeBtn.disabled = true;
|
| 209 |
mergeBtn.classList.add("disabled");
|
| 210 |
|
| 211 |
+
if (mode === "images") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
const pdfDoc = await PDFLib.PDFDocument.create();
|
| 213 |
|
| 214 |
for (const file of files) {
|
| 215 |
const bytes = await file.arrayBuffer();
|
|
|
|
| 216 |
const lower = file.name.toLowerCase();
|
| 217 |
+
let image;
|
| 218 |
|
| 219 |
if (
|
| 220 |
file.type === "image/jpeg" ||
|
|
|
|
| 244 |
}
|
| 245 |
|
| 246 |
const pdfBytes = await pdfDoc.save();
|
| 247 |
+
const outName =
|
| 248 |
+
(outputNameInput.value || "merged-images.pdf").trim() ||
|
| 249 |
+
"merged-images.pdf";
|
| 250 |
downloadPdf(pdfBytes, outName);
|
| 251 |
setStatus("تم إنشاء ملف PDF من الصور وتحميله بنجاح. ✅", "ok");
|
| 252 |
}
|
| 253 |
|
| 254 |
+
if (mode === "pdfs") {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
const pdfDoc = await PDFLib.PDFDocument.create();
|
| 256 |
|
| 257 |
for (const file of files) {
|
|
|
|
| 265 |
}
|
| 266 |
|
| 267 |
const pdfBytes = await pdfDoc.save();
|
| 268 |
+
const outName =
|
| 269 |
+
(outputNameInput.value || "merged-pdfs.pdf").trim() ||
|
| 270 |
+
"merged-pdfs.pdf";
|
| 271 |
downloadPdf(pdfBytes, outName);
|
| 272 |
setStatus("تم دمج ملفات PDF وتحميل الملف النهائي. ✅", "ok");
|
| 273 |
}
|