mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-08 16:57:14 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddd0e46e9b | ||
|
|
5119fd08f9 | ||
|
|
db3ffd3030 | ||
|
|
37b5956bd5 |
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/embedpdf/embed-pdf-viewer ./_upstream/embed-pdf-viewer
|
||||
run: git clone --depth 1 --branch main https://github.com/alam00000/bentopdf-embed-pdf-viewer ./_upstream/embed-pdf-viewer
|
||||
|
||||
- name: Setup Node
|
||||
if: steps.gate.outputs.run == 'true'
|
||||
|
||||
Generated
+156
-1998
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -87,7 +87,7 @@
|
||||
"bwip-js": "^4.8.0",
|
||||
"cropperjs": "^1.6.2",
|
||||
"diff": "^8.0.3",
|
||||
"embedpdf-snippet": "file:vendor/embedpdf/embedpdf-snippet-2.3.0.tgz",
|
||||
"embedpdf-snippet": "file:vendor/embedpdf/embedpdf-snippet-2.9.1.tgz",
|
||||
"heic2any": "^0.0.4",
|
||||
"highlight.js": "^11.11.1",
|
||||
"html2canvas": "^1.4.1",
|
||||
|
||||
@@ -121,6 +121,9 @@ 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;
|
||||
@@ -154,6 +157,7 @@ async function runOCR() {
|
||||
resolution: scale,
|
||||
binarize,
|
||||
whitelist,
|
||||
embedFullFonts,
|
||||
onProgress: updateProgress,
|
||||
});
|
||||
|
||||
|
||||
+14
-4
@@ -16,6 +16,7 @@ export interface OcrOptions {
|
||||
resolution: number;
|
||||
binarize: boolean;
|
||||
whitelist: string;
|
||||
embedFullFonts?: boolean;
|
||||
onProgress?: (status: string, progress: number) => void;
|
||||
}
|
||||
|
||||
@@ -131,7 +132,14 @@ export async function performOcr(
|
||||
pdfBytes: Uint8Array | ArrayBuffer,
|
||||
options: OcrOptions
|
||||
): Promise<OcrResult> {
|
||||
const { language, resolution, binarize, whitelist, onProgress } = options;
|
||||
const {
|
||||
language,
|
||||
resolution,
|
||||
binarize,
|
||||
whitelist,
|
||||
embedFullFonts,
|
||||
onProgress,
|
||||
} = options;
|
||||
const progress = onProgress || (() => {});
|
||||
|
||||
const worker = await createConfiguredTesseractWorker(
|
||||
@@ -198,14 +206,16 @@ export async function performOcr(
|
||||
getFontForLanguage('eng'),
|
||||
]);
|
||||
primaryFont = await newPdfDoc.embedFont(scriptFontBytes, {
|
||||
subset: false,
|
||||
subset: !embedFullFonts,
|
||||
});
|
||||
latinFont = await newPdfDoc.embedFont(latinFontBytes, {
|
||||
subset: false,
|
||||
subset: !embedFullFonts,
|
||||
});
|
||||
} else {
|
||||
const fontBytes = await getFontForLanguage(primaryLang);
|
||||
primaryFont = await newPdfDoc.embedFont(fontBytes, { subset: false });
|
||||
primaryFont = await newPdfDoc.embedFont(fontBytes, {
|
||||
subset: !embedFullFonts,
|
||||
});
|
||||
latinFont = primaryFont;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -259,6 +259,16 @@
|
||||
/>
|
||||
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
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
2.3.0
|
||||
2.9.1
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in new issue
Block a user