修正bug
parent
1c9a8da29e
commit
c528a2fcaf
22
src/app.js
22
src/app.js
|
|
@ -221,8 +221,8 @@ async function processSingle(item) {
|
||||||
img = await getPdfPreview(item.file);
|
img = await getPdfPreview(item.file);
|
||||||
item.originalImg = img;
|
item.originalImg = img;
|
||||||
originalInfo.innerHTML = `
|
originalInfo.innerHTML = `
|
||||||
<p>Type: PDF (NotebookLM)</p>
|
<div>Type: PDF (NotebookLM)</div>
|
||||||
<p>${i18n.t('info.size')}: ${(item.file.size / 1024 / 1024).toFixed(2)} MB</p>
|
<div>${i18n.t('info.size')}: ${(item.file.size / 1024 / 1024).toFixed(2)} MB</div>
|
||||||
`;
|
`;
|
||||||
setStatusMessage('NotebookLM PDF Detected', 'success');
|
setStatusMessage('NotebookLM PDF Detected', 'success');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -235,9 +235,9 @@ async function processSingle(item) {
|
||||||
|
|
||||||
const watermarkInfo = engine.getWatermarkInfo(img.width, img.height);
|
const watermarkInfo = engine.getWatermarkInfo(img.width, img.height);
|
||||||
originalInfo.innerHTML = `
|
originalInfo.innerHTML = `
|
||||||
<p>${i18n.t('info.size')}: ${img.width}×${img.height}</p>
|
<div>${i18n.t('info.size')}: ${img.width}×${img.height}</div>
|
||||||
<p>${i18n.t('info.watermark')}: ${watermarkInfo.width}×${watermarkInfo.height}</p>
|
<div>${i18n.t('info.watermark')}: ${watermarkInfo.width}×${watermarkInfo.height}</div>
|
||||||
<p>${i18n.t('info.position')}: (${watermarkInfo.position.x},${watermarkInfo.position.y})</p>
|
<div>${i18n.t('info.position')}: (${watermarkInfo.position.x},${watermarkInfo.position.y})</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,13 +279,13 @@ async function processSingle(item) {
|
||||||
|
|
||||||
if (item.isPdf) {
|
if (item.isPdf) {
|
||||||
processedInfo.innerHTML = `
|
processedInfo.innerHTML = `
|
||||||
<p>${i18n.t('info.status')}: ${i18n.t('info.removed')}</p>
|
<div>${i18n.t('info.status')}: ${i18n.t('info.removed')}</div>
|
||||||
<p>Output: PDF</p>
|
<div>Output: PDF</div>
|
||||||
`;
|
`;
|
||||||
} else {
|
} else {
|
||||||
processedInfo.innerHTML = `
|
processedInfo.innerHTML = `
|
||||||
<p>${i18n.t('info.size')}: ${img.width}×${img.height}</p>
|
<div>${i18n.t('info.size')}: ${img.width}×${img.height}</div>
|
||||||
<p>${i18n.t('info.status')}: ${i18n.t('info.removed')}</p>
|
<div>${i18n.t('info.status')}: ${i18n.t('info.removed')}</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -459,7 +459,7 @@ async function processPdf(file, onProgress) {
|
||||||
for (let i = 1; i <= total; i++) {
|
for (let i = 1; i <= total; i++) {
|
||||||
if (onProgress) onProgress(i, total);
|
if (onProgress) onProgress(i, total);
|
||||||
const page = await pdf.getPage(i);
|
const page = await pdf.getPage(i);
|
||||||
const viewport = page.getViewport({ scale: 2 });
|
const viewport = page.getViewport({ scale: 3 });
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
canvas.width = viewport.width;
|
canvas.width = viewport.width;
|
||||||
|
|
@ -488,7 +488,7 @@ async function processPdf(file, onProgress) {
|
||||||
|
|
||||||
const cleanedCanvas = await engine.removeWatermarkFromImage(canvas, { forceSimpleClone: true });
|
const cleanedCanvas = await engine.removeWatermarkFromImage(canvas, { forceSimpleClone: true });
|
||||||
|
|
||||||
const imgData = cleanedCanvas.toDataURL('image/jpeg', 0.9);
|
const imgData = cleanedCanvas.toDataURL('image/jpeg', 0.95);
|
||||||
|
|
||||||
// Capture first page as preview
|
// Capture first page as preview
|
||||||
if (i === 1) {
|
if (i === 1) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue