feat: add "Add Page Labels" tool to the application

- Introduced a new tool for adding page labels to PDF documents, allowing users to apply Roman numerals, prefixes, and custom numbering ranges.
- Created a new HTML page for the tool with a user-friendly interface for file upload and label rule configuration.
- Implemented logic for handling file uploads, processing PDF files, and applying page labels based on user-defined rules.
- Added necessary types and utility functions for managing page label styles and normalization of start values.
- Updated main application configuration to include the new tool in the navigation.
- Added tests for page label utilities to ensure correct functionality.
This commit is contained in:
alam00000
2026-03-16 14:34:27 +05:30
parent 31f43b557f
commit 477839f106
27 changed files with 2318 additions and 0 deletions

View File

@@ -86,6 +86,65 @@
"name": "頁碼",
"subtitle": "在你的文件中插入頁碼。"
},
"addPageLabels": {
"name": "新增頁面標籤",
"subtitle": "使用羅馬數字、前綴與自訂起始值套用 PDF 頁面標籤。",
"uploadHint": "PDF 檔案",
"howLabelsWorkTitle": "頁面標籤的運作方式",
"howLabelsWorkStep1": "將頁面範圍留空即可為所有頁面套用標籤。",
"howLabelsWorkStep2": "前置頁可使用羅馬數字,正文則可使用十進位編號等樣式。",
"howLabelsWorkStep3": "將前綴搭配起始值 0可建立像 A-0、A-1、A-2 這樣的標籤。",
"howLabelsWorkStep4": "當某條規則使用 1-9,30-40 或奇數頁等不連續範圍時,請啟用連續編號。",
"labelRulesTitle": "標籤規則",
"addRule": "新增規則",
"removeExistingLabels": "套用這些規則前先移除現有頁面標籤",
"cpdfNote": "此工具會在你的瀏覽器中使用 CoherentPDF。若 CoherentPDF 尚未設定,系統會提示你在 WASM 設定中完成設定。",
"processButton": "新增頁面標籤",
"howItWorksUploadTitle": "上傳檔案",
"howItWorksUploadDescription": "選擇你要重新標記的 PDF 檔案。",
"howItWorksDefineTitle": "定義規則",
"howItWorksDefineDescription": "設定一條或多條頁面標籤規則,包括頁面範圍、樣式、前綴與起始值。",
"howItWorksDownloadTitle": "下載",
"howItWorksDownloadDescription": "儲存套用新頁面標籤後的 PDF。",
"relatedToolsTitle": "相關 PDF 工具",
"faqWhatIsQuestion": "什麼是頁面標籤?",
"faqWhatIsAnswer": "頁面標籤是 PDF 閱讀器在縮圖、頁面導覽與列印對話框中顯示的編號。它不會在頁面本身額外列印新文字。",
"faqMixQuestion": "我可以混用羅馬數字和一般數字嗎?",
"faqMixAnswer": "可以。你可以新增多條規則,例如 1-4 使用 LowercaseRoman5-20 使用 DecimalArabic。",
"faqPrivacyQuestion": "我的檔案會保持私密嗎?",
"faqPrivacyAnswer": "會。處理程序會在你的瀏覽器中使用 CoherentPDF WASM 完成PDF 不會離開你的裝置。",
"invalidFileTitle": "無效檔案",
"invalidFileMessage": "請上傳有效的 PDF 檔案。",
"loadingPdf": "正在載入 PDF...",
"protectedPdfTitle": "受保護的 PDF",
"protectedPdfMessage": "此 PDF 受密碼保護。請先使用解密或變更權限工具。",
"loadErrorMessage": "無法載入 PDF 檔案。該檔案可能無效、毀損或受密碼保護。",
"fileMeta": "{{size}} • {{count}} 頁",
"ruleTitle": "標籤規則 {{number}}",
"pageRangeLabel": "頁面範圍",
"pageRangePlaceholder": "所有頁面,或例如 1-4、7、奇數頁",
"labelStyleLabel": "標籤樣式",
"labelPrefixLabel": "標籤前綴",
"labelPrefixPlaceholder": "可選前綴,例如 A-",
"startValueLabel": "起始值",
"continueNumbering": "在不連續範圍中持續編號",
"examplesNote": "例如1-4 用於前言的羅馬數字頁碼、15-20 使用前綴 A- 且起始值為 0或啟用連續編號的奇數頁。",
"uploadFirstMessage": "請先上傳 PDF 檔案。",
"applyingLabels": "正在套用頁面標籤...",
"invalidRangeMessage": "規則 {{number}} 的頁面範圍無效:{{range}}",
"allPages": "所有頁面",
"emptyOutputMessage": "CoherentPDF 產生了空白檔案。",
"successMessage": "頁面標籤新增成功!",
"processErrorMessage": "無法新增頁面標籤。",
"styleOptions": {
"DecimalArabic": "十進位數字",
"LowercaseRoman": "小寫羅馬數字",
"UppercaseRoman": "大寫羅馬數字",
"LowercaseLetters": "小寫字母",
"UppercaseLetters": "大寫字母",
"NoLabelPrefixOnly": "僅前綴,無編號"
}
},
"batesNumbering": {
"name": "Bates編號",
"subtitle": "在一個或多個PDF檔案中新增連續的Bates編號。"