diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index 35c335334..6802224cd 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -15,7 +15,6 @@ import {lockFile} from "../../dialog/processSystem"; import {pathPosix} from "../../util/pathName"; import {replaceLocalPath} from "../../editor/rename"; - export const saveExport = (option: { type: string, id: string }) => { /// #if !BROWSER if (option.type === "pdf") { @@ -157,59 +156,56 @@ const renderPDF = (id: string) => { }, 200); }); }); - fetchPost("/api/export/exportPreviewHTML", { - id, - }, response => { - let pdfWidth = ""; - if (localData.pageSize === "A3") { - if (localData.landscape) { - pdfWidth = "16.5"; - } else { - pdfWidth = "11.7"; - } - } else if (localData.pageSize === "A4") { - if (localData.landscape) { - pdfWidth = "11.7"; - } else { - pdfWidth = "8.8"; - } - } else if (localData.pageSize === "A5") { - if (localData.landscape) { - pdfWidth = "8.3"; - } else { - pdfWidth = "5.8"; - } - } else if (localData.pageSize === "Legal") { - if (localData.landscape) { - pdfWidth = "14"; - } else { - pdfWidth = "8.5"; - } - } else if (localData.pageSize === "Letter") { - if (localData.landscape) { - pdfWidth = "11"; - } else { - pdfWidth = "8.5"; - } - } else if (localData.pageSize === "Tabloid") { - if (localData.landscape) { - pdfWidth = "17"; - } else { - pdfWidth = "11"; - } + let pdfWidth = ""; + if (localData.pageSize === "A3") { + if (localData.landscape) { + pdfWidth = "16.5"; + } else { + pdfWidth = "11.7"; } - let pdfMargin = "0.66"; + } else if (localData.pageSize === "A4") { + if (localData.landscape) { + pdfWidth = "11.7"; + } else { + pdfWidth = "8.8"; + } + } else if (localData.pageSize === "A5") { + if (localData.landscape) { + pdfWidth = "8.3"; + } else { + pdfWidth = "5.8"; + } + } else if (localData.pageSize === "Legal") { + if (localData.landscape) { + pdfWidth = "14"; + } else { + pdfWidth = "8.5"; + } + } else if (localData.pageSize === "Letter") { + if (localData.landscape) { + pdfWidth = "11"; + } else { + pdfWidth = "8.5"; + } + } else if (localData.pageSize === "Tabloid") { + if (localData.landscape) { + pdfWidth = "17"; + } else { + pdfWidth = "11"; + } + } + let pdfMargin = "0.66"; + if (localData.landscape) { + pdfMargin = "1.69"; + } + if (localData.marginsType !== 0) { if (localData.landscape) { pdfMargin = "1.69"; + } else { + pdfMargin = "0.3"; } - if (localData.marginsType !== 0) { - if (localData.landscape) { - pdfMargin = "1.69"; - } else { - pdfMargin = "0.3"; - } - } - const html = ` + } + const html = `
@@ -219,7 +215,7 @@ const renderPDF = (id: string) => { -