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": "Page Numbers",
"subtitle": "Insert page numbers into your document."
},
"addPageLabels": {
"name": "Add Page Labels",
"subtitle": "Apply PDF page labels with Roman numerals, prefixes, and custom starts.",
"uploadHint": "PDF file",
"howLabelsWorkTitle": "How labels work",
"howLabelsWorkStep1": "Leave Page Range empty to label all pages.",
"howLabelsWorkStep2": "Use styles like Roman numerals for front matter and decimal numbering for the main body.",
"howLabelsWorkStep3": "Use Prefix with Start Value 0 to create labels such as A-0, A-1, A-2.",
"howLabelsWorkStep4": "Enable progress when one rule uses a disjoint range such as 1-9,30-40 or odd.",
"labelRulesTitle": "Label Rules",
"addRule": "Add Rule",
"removeExistingLabels": "Remove existing page labels before applying these rules",
"cpdfNote": "This tool uses CoherentPDF in your browser. If CoherentPDF is not configured, you will be prompted to set it up in WASM Settings.",
"processButton": "Add Page Labels",
"howItWorksUploadTitle": "Upload File",
"howItWorksUploadDescription": "Choose the PDF you want to relabel.",
"howItWorksDefineTitle": "Define Rules",
"howItWorksDefineDescription": "Set one or more page label rules with page ranges, styles, prefixes, and starting values.",
"howItWorksDownloadTitle": "Download",
"howItWorksDownloadDescription": "Save the updated PDF with its new page labels.",
"relatedToolsTitle": "Related PDF Tools",
"faqWhatIsQuestion": "What is a page label?",
"faqWhatIsAnswer": "A page label is the numbering shown by PDF readers in thumbnails, page navigation, and print dialogs. It does not print new text onto the page itself.",
"faqMixQuestion": "Can I mix Roman numerals and normal numbers?",
"faqMixAnswer": "Yes. Add multiple rules, such as 1-4 with LowercaseRoman and 5-20 with DecimalArabic.",
"faqPrivacyQuestion": "Do my files stay private?",
"faqPrivacyAnswer": "Yes. The processing happens in your browser using CoherentPDF WASM. Your PDF does not leave your device.",
"invalidFileTitle": "Invalid File",
"invalidFileMessage": "Please upload a valid PDF file.",
"loadingPdf": "Loading PDF...",
"protectedPdfTitle": "Protected PDF",
"protectedPdfMessage": "This PDF is password-protected. Please use the Decrypt or Change Permissions tool first.",
"loadErrorMessage": "Failed to load PDF file. The file may be invalid, corrupted, or password-protected.",
"fileMeta": "{{size}} • {{count}} pages",
"ruleTitle": "Label Rule {{number}}",
"pageRangeLabel": "Page Range",
"pageRangePlaceholder": "All pages, or e.g. 1-4, 7, odd",
"labelStyleLabel": "Label Style",
"labelPrefixLabel": "Label Prefix",
"labelPrefixPlaceholder": "Optional prefix, e.g. A-",
"startValueLabel": "Start Value",
"continueNumbering": "Continue numbering across disjoint ranges",
"examplesNote": "Examples: 1-4 for Roman front matter, 15-20 with prefix A- and start value 0, or odd with progress enabled.",
"uploadFirstMessage": "Please upload a PDF file first.",
"applyingLabels": "Applying page labels...",
"invalidRangeMessage": "Rule {{number}} has an invalid page range: {{range}}",
"allPages": "all pages",
"emptyOutputMessage": "CoherentPDF produced an empty file.",
"successMessage": "Page labels added successfully!",
"processErrorMessage": "Could not add page labels.",
"styleOptions": {
"DecimalArabic": "Decimal Arabic",
"LowercaseRoman": "Lowercase Roman",
"UppercaseRoman": "Uppercase Roman",
"LowercaseLetters": "Lowercase Letters",
"UppercaseLetters": "Uppercase Letters",
"NoLabelPrefixOnly": "No Label Prefix Only"
}
},
"batesNumbering": {
"name": "Bates Numbering",
"subtitle": "Add sequential Bates numbers across one or more PDF files."