feat(前端界面): OFDGo WebUI移除打印功能
build.yaml / build (push) Successful in 1m27s

This commit is contained in:
2026-07-09 15:13:18 +08:00
parent 51076634fa
commit 368bafccdb
3 changed files with 0 additions and 122 deletions
-1
View File
@@ -44,7 +44,6 @@
<select id="pageExportFormat" class="format-select" title="单页格式" aria-label="单页格式" disabled></select> <select id="pageExportFormat" class="format-select" title="单页格式" aria-label="单页格式" disabled></select>
<button id="exportPageButton" class="button" type="button" data-short="单" title="导出单页" aria-label="导出单页" disabled>单页</button> <button id="exportPageButton" class="button" type="button" data-short="单" title="导出单页" aria-label="导出单页" disabled>单页</button>
<button id="exportButton" class="button" type="button" data-short="全" title="导出文档 PDF" aria-label="导出文档 PDF" disabled>文档</button> <button id="exportButton" class="button" type="button" data-short="全" title="导出文档 PDF" aria-label="导出文档 PDF" disabled>文档</button>
<button id="printButton" class="button" type="button" data-short="打印" title="浏览器打印" aria-label="浏览器打印" disabled>打印</button>
</div> </div>
</header> </header>
-72
View File
@@ -1086,75 +1086,3 @@ body[data-hide-meta] .meta-panel {
justify-content: flex-end; justify-content: flex-end;
} }
} }
@media print {
@page {
margin: 0;
}
html,
body {
width: auto;
height: auto;
min-width: 0;
overflow: visible;
background: #ffffff;
}
.app {
display: block;
height: auto;
overflow: visible;
}
.app-bar,
.app-footer,
.page-list-panel,
.meta-panel,
.empty-state,
.progress-panel,
.stamp-highlight {
display: none !important;
}
.workspace,
.viewer-panel,
.page-frame,
.svg-host {
display: block;
width: auto;
min-width: 0;
min-height: 0;
height: auto;
margin: 0;
padding: 0;
overflow: visible;
background: #ffffff;
}
.page-shell {
width: var(--page-width) !important;
height: var(--page-height) !important;
overflow: hidden;
border: 0;
box-shadow: none;
break-inside: avoid;
page-break-inside: avoid;
}
.page-shell:not(:last-child) {
break-after: page;
page-break-after: always;
}
.page-surface {
width: var(--page-width) !important;
height: var(--page-height) !important;
transform: none !important;
}
.ofd-svg {
width: var(--page-width) !important;
height: var(--page-height) !important;
}
}
-49
View File
@@ -27,7 +27,6 @@ const STATUS = {
fonts: "正在匹配字体", fonts: "正在匹配字体",
exporting: "正在导出文档 PDF", exporting: "正在导出文档 PDF",
pageExporting: "正在导出单页", pageExporting: "正在导出单页",
printing: "正在准备打印",
}; };
const WASM_CALLBACKS = [ const WASM_CALLBACKS = [
"ofdgoOpen", "ofdgoOpen",
@@ -99,7 +98,6 @@ const el = {
pageExportFormat: document.querySelector("#pageExportFormat"), pageExportFormat: document.querySelector("#pageExportFormat"),
exportPageButton: document.querySelector("#exportPageButton"), exportPageButton: document.querySelector("#exportPageButton"),
exportButton: document.querySelector("#exportButton"), exportButton: document.querySelector("#exportButton"),
printButton: document.querySelector("#printButton"),
emptyState: document.querySelector("#emptyState"), emptyState: document.querySelector("#emptyState"),
progressPanel: document.querySelector("#progressPanel"), progressPanel: document.querySelector("#progressPanel"),
progressLabel: document.querySelector("#progressLabel"), progressLabel: document.querySelector("#progressLabel"),
@@ -144,7 +142,6 @@ el.annotationButton.addEventListener("click", toggleAnnotations);
el.renderDPI.addEventListener("change", changeDPI); el.renderDPI.addEventListener("change", changeDPI);
el.exportPageButton.addEventListener("click", exportCurrentPage); el.exportPageButton.addEventListener("click", exportCurrentPage);
el.exportButton.addEventListener("click", exportPDF); el.exportButton.addEventListener("click", exportPDF);
el.printButton.addEventListener("click", printDocument);
el.pageInput.addEventListener("change", () => { el.pageInput.addEventListener("change", () => {
const page = Number.parseInt(el.pageInput.value, 10); const page = Number.parseInt(el.pageInput.value, 10);
if (Number.isFinite(page)) { if (Number.isFinite(page)) {
@@ -1071,50 +1068,6 @@ async function exportCurrentPage() {
} }
} }
async function printDocument() {
if (!state.doc) {
return;
}
const openSeq = state.openSeq;
setExportControlsDisabled(true);
setBusy(true, "正在准备打印", 18, STATUS.printing);
try {
await renderPagesForPrint(openSeq);
if (openSeq !== state.openSeq) {
return;
}
setProgress("正在打开打印", 86);
await waitForPaint();
if (openSeq !== state.openSeq) {
return;
}
setBusy(false);
updateControls();
window.print();
setStatus("已打开打印");
} catch (err) {
if (openSeq === state.openSeq) {
showError(err, false);
}
} finally {
if (openSeq === state.openSeq) {
setBusy(false);
updateControls();
}
}
}
async function renderPagesForPrint(openSeq) {
const pages = state.doc?.pages || [];
for (let i = 0; i < pages.length; i += 1) {
if (openSeq !== state.openSeq) {
return;
}
setProgress(`正在渲染打印 ${i + 1}/${pages.length}`, 20 + Math.round(i / Math.max(1, pages.length) * 62), STATUS.printing);
await renderFlowPage(pages[i].index, { throwError: true, openSeq, priority: 0 });
}
}
function renderPageFlow() { function renderPageFlow() {
el.svgHost.replaceChildren(); el.svgHost.replaceChildren();
if (!state.doc) { if (!state.doc) {
@@ -2152,7 +2105,6 @@ function updateControls() {
el.pageExportFormat.disabled = !hasDoc || !state.exportFormats.length; el.pageExportFormat.disabled = !hasDoc || !state.exportFormats.length;
el.exportPageButton.disabled = !hasDoc || !state.exportFormats.length; el.exportPageButton.disabled = !hasDoc || !state.exportFormats.length;
el.exportButton.disabled = !hasDoc; el.exportButton.disabled = !hasDoc;
el.printButton.disabled = !hasDoc;
} }
function updateAnnotationButton() { function updateAnnotationButton() {
@@ -2165,7 +2117,6 @@ function setExportControlsDisabled(disabled) {
el.exportButton.disabled = disabled; el.exportButton.disabled = disabled;
el.exportPageButton.disabled = disabled; el.exportPageButton.disabled = disabled;
el.pageExportFormat.disabled = disabled; el.pageExportFormat.disabled = disabled;
el.printButton.disabled = disabled;
} }
function callWASM(name, ...args) { function callWASM(name, ...args) {