mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-10 09:14:34 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3423decd6 |
No files matched your search
@@ -55,7 +55,7 @@ jobs:
|
||||
|
||||
- name: Clone upstream embed-pdf-viewer
|
||||
if: steps.gate.outputs.run == 'true'
|
||||
run: git clone --depth 1 --branch main https://github.com/alam00000/bentopdf-embed-pdf-viewer ./_upstream/embed-pdf-viewer
|
||||
run: git clone --depth 1 --branch main https://github.com/embedpdf/embed-pdf-viewer ./_upstream/embed-pdf-viewer
|
||||
|
||||
- name: Setup Node
|
||||
if: steps.gate.outputs.run == 'true'
|
||||
|
||||
Generated
+1852
-8
File diff suppressed because it is too large.
Load diff
@@ -121,9 +121,6 @@ async function runOCR() {
|
||||
);
|
||||
const binarize = (document.getElementById('ocr-binarize') as HTMLInputElement)
|
||||
.checked;
|
||||
const embedFullFonts = (
|
||||
document.getElementById('ocr-embed-full-fonts') as HTMLInputElement
|
||||
).checked;
|
||||
const whitelist = (
|
||||
document.getElementById('ocr-whitelist') as HTMLInputElement
|
||||
).value;
|
||||
@@ -157,7 +154,6 @@ async function runOCR() {
|
||||
resolution: scale,
|
||||
binarize,
|
||||
whitelist,
|
||||
embedFullFonts,
|
||||
onProgress: updateProgress,
|
||||
});
|
||||
|
||||
|
||||
+4
-14
@@ -16,7 +16,6 @@ export interface OcrOptions {
|
||||
resolution: number;
|
||||
binarize: boolean;
|
||||
whitelist: string;
|
||||
embedFullFonts?: boolean;
|
||||
onProgress?: (status: string, progress: number) => void;
|
||||
}
|
||||
|
||||
@@ -132,14 +131,7 @@ export async function performOcr(
|
||||
pdfBytes: Uint8Array | ArrayBuffer,
|
||||
options: OcrOptions
|
||||
): Promise<OcrResult> {
|
||||
const {
|
||||
language,
|
||||
resolution,
|
||||
binarize,
|
||||
whitelist,
|
||||
embedFullFonts,
|
||||
onProgress,
|
||||
} = options;
|
||||
const { language, resolution, binarize, whitelist, onProgress } = options;
|
||||
const progress = onProgress || (() => {});
|
||||
|
||||
const worker = await createConfiguredTesseractWorker(
|
||||
@@ -206,16 +198,14 @@ export async function performOcr(
|
||||
getFontForLanguage('eng'),
|
||||
]);
|
||||
primaryFont = await newPdfDoc.embedFont(scriptFontBytes, {
|
||||
subset: !embedFullFonts,
|
||||
subset: false,
|
||||
});
|
||||
latinFont = await newPdfDoc.embedFont(latinFontBytes, {
|
||||
subset: !embedFullFonts,
|
||||
subset: false,
|
||||
});
|
||||
} else {
|
||||
const fontBytes = await getFontForLanguage(primaryLang);
|
||||
primaryFont = await newPdfDoc.embedFont(fontBytes, {
|
||||
subset: !embedFullFonts,
|
||||
});
|
||||
primaryFont = await newPdfDoc.embedFont(fontBytes, { subset: false });
|
||||
latinFont = primaryFont;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -259,16 +259,6 @@
|
||||
/>
|
||||
Binarize Image (Enhance Contrast for Clean Scans)
|
||||
</label>
|
||||
<label
|
||||
class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
id="ocr-embed-full-fonts"
|
||||
class="w-4 h-4 rounded text-indigo-600 bg-gray-700 border-gray-600"
|
||||
/>
|
||||
Embed Full Fonts (Larger file, better compatibility)
|
||||
</label>
|
||||
<!-- Whitelist Presets -->
|
||||
<div>
|
||||
<label
|
||||
|
||||
BIN
Binary file not shown.
Reference in new issue
Block a user