mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-08 00:50:59 +01:00
refactor: remove HTML report export and implement PDF export options in PDF comparison tool
- Deleted the exportCompareHtmlReport function and its related imports. - Introduced a dropdown menu for exporting comparison results as PDFs with multiple modes (split, alternating, left, right). - Updated the comparison logic to utilize caching for page models and comparison results. - Refactored rendering functions to improve code organization and maintainability. - Enhanced UI elements for better user experience during PDF export.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { CompareTextItem } from '../types.ts';
|
||||
import type { CompareRectangle, CompareTextItem } from '../types.ts';
|
||||
|
||||
export function normalizeCompareText(text: string) {
|
||||
return text
|
||||
@@ -62,3 +62,22 @@ export function isLowQualityExtractedText(text: string) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function tokenizeText(text: string): string[] {
|
||||
return text.split(/\s+/).filter(Boolean);
|
||||
}
|
||||
|
||||
export function tokenizeTextAsSet(text: string): Set<string> {
|
||||
return new Set(tokenizeText(text));
|
||||
}
|
||||
|
||||
export function calculateBoundingRect(
|
||||
rects: CompareRectangle[]
|
||||
): CompareRectangle {
|
||||
if (rects.length === 0) return { x: 0, y: 0, width: 0, height: 0 };
|
||||
const minX = Math.min(...rects.map((r) => r.x));
|
||||
const minY = Math.min(...rects.map((r) => r.y));
|
||||
const maxX = Math.max(...rects.map((r) => r.x + r.width));
|
||||
const maxY = Math.max(...rects.map((r) => r.y + r.height));
|
||||
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user