?? ?? ???? ?? ? ???? ?? ??? ??, ???? ????? ?????? ?? ??? ?? ??????. Dynamsoft Document Viewer SDK? ???? ???? ???? ????, ???, ?? ???? ?? ??? ??? ? ?? ?????? ? ?(PWA) ?? ???? ??? ? ????. ??? ??? PDF ???? ???? ?? ???? ??? ? ????. ? ????? Dynamsoft Document Viewer SDK? ???? PWA ?? ???? ??? ??? ?????.
PWA ?? ??? ?? ???
?? ??
-
Dynamsoft Document Viewer: ? ???? JPEG, PNG, TIFF, BMP. ?? ???? PDF ???, ??? ??, ??? ?? ?? ? ?? ?? ??? ?????. npm?? SDK? ?? ? ????.
-
Dynamsoft Capture Vision ??? ????: Dynamsoft SDK? ?? ??? ?? ???? ???? 30? ?? ??? ????
Base64 ???? ???? ?? PDF ??? ?? ???? ????
Node.js/Express ??? ??? ?????.
??? ??- ??? ?? ???:
mkdir server cd server
- Node.js ???? ???:
npm init -y
Express ? cors ??:
npm install express cors
??
- Express? ? ?? ??? ??????.
- CORS(Cross-Origin Resource Sharing)? Cross-Origin ??? ???? ???????.
- ?? ??? ???? index.js ??? ????.
const express = require('express'); const cors = require('cors'); const fs = require('fs'); const path = require('path'); const app = express(); const PORT = 3000; app.use(cors()); app.use(express.json({ limit: '10mb' })); app.post('/upload', (req, res) => { const { image } = req.body; if (!image) { return res.status(400).json({ error: 'No image provided.' }); } const buffer = Buffer.from(image, 'base64'); // Save the image to disk const filename = `image_${Date.now()}.pdf`; const filepath = path.join(__dirname, 'uploads', filename); // Ensure the uploads directory exists if (!fs.existsSync('uploads')) { fs.mkdirSync('uploads'); } fs.writeFile(filepath, buffer, (err) => { if (err) { console.error('Failed to save image:', err); return res.status(500).json({ error: 'Failed to save image.' }); } console.log('Image saved:', filename); res.json({ message: 'Image uploaded successfully!', filename }); }); }); // Start the server app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); });
- ? ?? ??:
node index.js
Dynamsoft Document Viewer? ????? GitHub ???(https://github.com/Dynamsoft/mobile-web-capture/tree/master/samples/complete-document-capturing-)?? ?? ?? ??? ???????. ?? ??. ? ??? Dynamsoft Document Viewer SDK? ???? ?? ???? ???? ??? ?? ??? ???? ??? ?????.
????? ???? ?? ??? ?????.
- PWA? ?????.
- ??? ??? PDF ??? ??? ??????.
? ????? PWA? ???? ???
-
PWA ????? ?? ???:
mkdir server cd server
?? ??? ????? ??? ?????.
-
?? ???? ???? ????? ?? ????? ?????.json ??? ????.
npm init -y
-
?? ???? ????? ?? ????? sw.js ??? ????.
npm install express cors
-
index.html ??? ??? ??? ?????.
const express = require('express'); const cors = require('cors'); const fs = require('fs'); const path = require('path'); const app = express(); const PORT = 3000; app.use(cors()); app.use(express.json({ limit: '10mb' })); app.post('/upload', (req, res) => { const { image } = req.body; if (!image) { return res.status(400).json({ error: 'No image provided.' }); } const buffer = Buffer.from(image, 'base64'); // Save the image to disk const filename = `image_${Date.now()}.pdf`; const filepath = path.join(__dirname, 'uploads', filename); // Ensure the uploads directory exists if (!fs.existsSync('uploads')) { fs.mkdirSync('uploads'); } fs.writeFile(filepath, buffer, (err) => { if (err) { console.error('Failed to save image:', err); return res.status(500).json({ error: 'Failed to save image.' }); } console.log('Image saved:', filename); res.json({ message: 'Image uploaded successfully!', filename }); }); }); // Start the server app.listen(PORT, () => { console.log(`Server is running on http://localhost:${PORT}`); });
??? ??? PDF ??? ???
-
uiConfig.js?? save?? ?? ???? ?? ??? ?? ???? ??? ?????.
node index.js
-
index.html?? save ???? ?????. ??? PDF? ??? ? Blob? Base64 ???? ???? ??? ??????.
mkdir client cd client
PWA ?? ??? ??
-
????? ?? ?????? ? ??? ?????.
{ "short_name": "MyPWA", "name": "My Progressive Web App", "icons": [ { "src": "icon.png", "sizes": "192x192", "type": "image/png" } ], "start_url": "/", "display": "standalone", "background_color": "#ffffff", "theme_color": "#000000" }
-
? ?????? http://localhost:8000? ?????.
?? ??
https://github.com/yushulx/web-twain-document-scan-management/tree/main/examples/pwa
? ??? PWA ?? ???? ???? ??: PDF? ??, ?? ? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

JavaScript? ??? ??? ?? ??, ? ? ? ?? ???? ???? ??? ??? ?????. 1. ?? ??? ?? ??? ???? ??? ??? ??? ??? ?? WebAPI? ?????. 2. WebAPI? ??????? ??? ?? ? ? ??? ?? ??? (??? ?? ?? ???? ??)? ????. 3. ??? ??? ?? ??? ?? ??? ?????. ?? ??? ??? ????? ??? ??? ?? ? ???? ?????. 4. ???? ?? (? : Promise. 5. ??? ??? ???? ?? ???? ???? ?? ?? ?? ??? ????? ? ??????.

??? ??? ?? ???? ?? ??? ???? ?? ??? ??? ?? ??? ?? ??? ?????. 1. ??? ?? : ?? ??? ?? ? ? ???? ?? ??? ???? ??? ???? ??????. ?? ??, ??? ?? ? ? ?? ??? ?? ? ?? ??? ??????. 2. ??? ?? : ??? ???? ?? ?? ??? ?? ???? ????? ? ?? ?????? ???? ????? ? ?? ?? ??? true? ??????. 3. ?? ???? ?? ?? ??? ?? ??, ?? ??? ? ?? ???? ?????. 4. DOM ??? ???? ??, ?? ? ??? ? ??? ??? ?? ???? ?? ???? ?????.

JavaScript ???? ? ? ?? ??? ???? ??? ???? ?? ??? ????. 1. ??? ???? ??? ??, ??, ??? ?? ? ??? ??? ?? ? ? ????. 2. ?? ? findIndex? ?? ?? ?? ???? ?? ? ?????. 3. ??? ??? ????? ?? ?? ??? ???? ? ?????. 4. ??? ?? ? ? ??? ?? ??? ?????. 5. ???? ??? ?? ??? ??? ? ?? ?????????. ??? ??? ????? ???? ????? ????.
