mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 15:06:46 +08:00
1 parent
f39675233c
commit
773b4195f5
10 files changed
+217
-29
No files matched your search
@@ -57,7 +57,7 @@
|
||||
<option value="300" selected>300 dpi</option>
|
||||
<option value="600">600 dpi</option>
|
||||
</select><span id="dpiValue" aria-hidden="true">300</span></label>
|
||||
<label class="toolbar-select"><select id="outputCompression" class="format-select" title="压缩" aria-label="压缩" disabled><option value="0">默认</option><option value="1">无损</option><option value="2">有损</option></select><span id="compressionValue" data-short="默" aria-hidden="true">默认</span></label>
|
||||
<label class="toolbar-select"><select id="outputCompression" class="format-select" title="压缩" aria-label="压缩" disabled><option value="0">默认</option><option value="1">无损</option><option value="2">轻压</option><option value="3">中压</option><option value="4">强压</option></select><span id="compressionValue" data-short="默" aria-hidden="true">默认</span></label>
|
||||
<button id="exportPageButton" class="button" type="button" data-short="单" title="导出单页" aria-label="导出单页" disabled>单页</button>
|
||||
<button id="exportButton" class="button" type="button" data-short="多" title="导出文档" aria-label="导出文档" aria-haspopup="dialog" aria-controls="exportPanel" disabled>文档</button>
|
||||
</div>
|
||||
@@ -184,7 +184,7 @@
|
||||
<button id="convertAdd" class="button" type="button">添加</button><button id="convertClear" class="button" type="button">清空</button>
|
||||
<div class="convert-options">
|
||||
<div class="form-row"><label for="convertFormat">格式</label><select id="convertFormat" required></select></div>
|
||||
<div class="form-row"><label for="convertCompression">压缩</label><select id="convertCompression"><option value="0">默认</option><option value="1">无损</option><option value="2">有损</option></select></div>
|
||||
<div class="form-row"><label for="convertCompression">压缩</label><select id="convertCompression"><option value="0">默认</option><option value="1">无损</option><option value="2">轻压</option><option value="3">中压</option><option value="4">强压</option></select></div>
|
||||
<div id="convertDPIRow" class="form-row" hidden><label for="convertDPI">精度</label><select id="convertDPI"><option value="96">96 dpi</option><option value="150">150 dpi</option><option value="300" selected>300 dpi</option><option value="600">600 dpi</option></select></div>
|
||||
<div class="form-row"><label for="convertDestination">保存</label><select id="convertDestination"><option value="directory">目录</option><option value="archive">打包</option></select></div>
|
||||
</div>
|
||||
|
||||
@@ -961,9 +961,12 @@ button:not(:disabled):hover {
|
||||
}
|
||||
.convert-dialog .form-actions {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
row-gap: 12px;
|
||||
}
|
||||
.convert-dialog .form-actions > .button { grid-row: 2; }
|
||||
.convert-dialog .form-actions > .button { grid-row: 2; width: 100%; }
|
||||
#convertClose { grid-column: 3; }
|
||||
#convertCancel, #convertStart { grid-column: 4; }
|
||||
.convert-options {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 1;
|
||||
|
||||
@@ -1254,7 +1254,7 @@ document.addEventListener("selectionchange", syncSelection);
|
||||
el.exportFormat.addEventListener("change", () => updateDPIControl());
|
||||
el.outputCompression.addEventListener("change", () => {
|
||||
el.compressionValue.textContent = el.outputCompression.selectedOptions[0].textContent;
|
||||
el.compressionValue.dataset.short = ["默", "无", "有"][Number(el.outputCompression.value)];
|
||||
el.compressionValue.dataset.short = ["默", "无", "轻", "中", "强"][Number(el.outputCompression.value)];
|
||||
});
|
||||
el.exportPageButton.addEventListener("click", () => exportFile(false));
|
||||
el.exportButton.addEventListener("click", () => openExportPanel());
|
||||
@@ -4646,7 +4646,7 @@ async function signDocument(event) {
|
||||
pages:el.signPages.value.trim(), placement:el.signPlacement.value,
|
||||
x:Number(el.signX.value), y:Number(el.signY.value), width:Number(el.signWidth.value), height:Number(el.signHeight.value),
|
||||
mode:el.signMode.value, lock:el.signLock.checked,
|
||||
compression: { mode: Number(el.outputCompression.value) || 0 },
|
||||
compression: compressionOptions(el.outputCompression.value),
|
||||
};
|
||||
el.signKey.value = "";
|
||||
if (openSeq !== state.openSeq || state.signCanceled || !el.signPanel.open) return;
|
||||
@@ -4966,7 +4966,7 @@ async function runBatch() {
|
||||
if (!defaultFormat) return;
|
||||
const pageRange = item => item.pages.trim() === "全部" ? "" : item.pages.trim();
|
||||
const dpi = Number(batchElements.DPI.value);
|
||||
const compression = { mode: Number(batchElements.Compression.value) || 0 };
|
||||
const compression = compressionOptions(batchElements.Compression.value);
|
||||
const archive = batchElements.Destination.value === "archive";
|
||||
const backend = state.renderBackend;
|
||||
const fontKey = [fontManager.permission, fontManager.records().map(font => [font.id, font.name, font.enabled, font.checksum])];
|
||||
@@ -5092,12 +5092,17 @@ async function runBatch() {
|
||||
}
|
||||
}
|
||||
|
||||
function compressionOptions(value) {
|
||||
const preset = Number(value) || 0;
|
||||
return preset > 2 ? { mode: 2, level: preset - 2 } : { mode: preset };
|
||||
}
|
||||
|
||||
async function exportFile(whole, indices = null, value = el.exportFormat.value, encryption = null) {
|
||||
if (!state.doc || document.body.hasAttribute("aria-busy")) {
|
||||
return;
|
||||
}
|
||||
const saving = value === "ofd";
|
||||
const compression = { mode: Number(el.outputCompression.value) || 0 };
|
||||
const compression = compressionOptions(el.outputCompression.value);
|
||||
const outputOptions = compression.mode ? [compression] : [];
|
||||
if (saving && !state.editorInfo && !state.ofdBytes && !encryption) {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user