@scanfit/browser 0.1.0-alpha.0 → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @scanfit/browser
|
|
2
|
+
|
|
3
|
+
Turn camera captures or image files into an inspected PDF that fits a byte limit. Processing stays in the browser; ScanFit does not upload documents or require a backend.
|
|
4
|
+
|
|
5
|
+
> Public alpha: test the exported pixels and your target devices before using ScanFit in a production document workflow.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @scanfit/browser@next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
React is an optional peer dependency. Install React 18.2 or 19 when using the ready-made interface.
|
|
14
|
+
|
|
15
|
+
## React scanner
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { DocumentScanner } from "@scanfit/browser/react";
|
|
19
|
+
import "@scanfit/browser/styles.css";
|
|
20
|
+
|
|
21
|
+
export function ApplicationDocuments() {
|
|
22
|
+
return (
|
|
23
|
+
<DocumentScanner
|
|
24
|
+
maxBytes={2_000_000}
|
|
25
|
+
onComplete={({ file, report }) => {
|
|
26
|
+
// Called after the user inspects and confirms the exported PDF.
|
|
27
|
+
attachToForm(file, report);
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `@scanfit/browser/trigger` for a small lazy-loaded dialog launcher, or `useScanSession` for a headless React integration.
|
|
35
|
+
|
|
36
|
+
## Framework-independent core
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { createScanSession } from "@scanfit/browser/core";
|
|
40
|
+
|
|
41
|
+
const session = createScanSession();
|
|
42
|
+
await session.addFiles(selectedImages);
|
|
43
|
+
|
|
44
|
+
const result = await session.exportPdf({ maxBytes: 2_000_000 });
|
|
45
|
+
|
|
46
|
+
if (result.status === "ready") {
|
|
47
|
+
receivePdf(result.file, result.report);
|
|
48
|
+
} else if (result.status === "cannot-fit") {
|
|
49
|
+
showCompressionLimits(result.report);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
session.dispose();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## What it provides
|
|
56
|
+
|
|
57
|
+
- JPEG, PNG and WebP import plus manual camera capture.
|
|
58
|
+
- Independent document-edge detection with manual corner correction.
|
|
59
|
+
- Rotation, natural color, grayscale and contrast adjustments.
|
|
60
|
+
- Page removal and reordering with drag-free controls.
|
|
61
|
+
- A bounded compression search and exact completed-PDF byte check.
|
|
62
|
+
- Per-page byte diagnostics and previews of the compressed pixels embedded in the PDF.
|
|
63
|
+
- Worker processing, cancellation, stale-job protection and resource cleanup.
|
|
64
|
+
- Replaceable detector and framework-independent TypeScript interfaces.
|
|
65
|
+
|
|
66
|
+
ScanFit returns `cannot-fit` when the configured quality and resolution floors cannot meet the requested limit. It does not silently omit pages, cross those floors, or switch color modes.
|
|
67
|
+
|
|
68
|
+
## Current limits
|
|
69
|
+
|
|
70
|
+
The alpha creates image-only PDFs. It does not include HEIC conversion, existing-PDF import, OCR, searchable or tagged PDFs, redaction, automatic capture, document persistence, telemetry or uploads. Camera behavior and performance still require validation on your supported physical devices.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
- [Complete usage and API guide](https://github.com/Ahmedsultan09/scanfit#readme)
|
|
75
|
+
- [Independent detector design](https://github.com/Ahmedsultan09/scanfit/blob/main/docs/DETECTOR.md)
|
|
76
|
+
- [Verification evidence](https://github.com/Ahmedsultan09/scanfit/blob/main/docs/VERIFICATION.md)
|
|
77
|
+
- [Release checklist](https://github.com/Ahmedsultan09/scanfit/blob/main/docs/RELEASE_CHECKLIST.md)
|
|
78
|
+
- [Runnable framework examples](https://github.com/Ahmedsultan09/scanfit/tree/main/examples)
|
|
79
|
+
- [Security policy](https://github.com/Ahmedsultan09/scanfit/blob/main/SECURITY.md)
|
|
80
|
+
|
|
81
|
+
MIT licensed. Public reports and fixtures must use synthetic, licensed or fully redacted documents.
|