Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: pdf

Vanessabf969395f476
diff --git a/app/electron/main.js b/app/electron/main.js
index fa87a2e5f9..43f0d43273 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -908,10 +908,12 @@ app.whenReady().then(() => {
});
ipcMain.on("siyuan-export-newwindow", (event, data) => {
// The PDF/Word export preview window automatically adjusts according to the size of the main window https://github.com/siyuan-note/siyuan/issues/10554
+ const wndBounds = getWindowByContentId(event.sender.id).getBounds();
+ const wndScreen = screen.getDisplayNearestPoint({x: wndBounds.x, y: wndBounds.y});
const printWin = new BrowserWindow({
show: true,
- width: Math.floor(screen.getPrimaryDisplay().size.width * 0.8),
- height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8),
+ width: Math.floor(wndScreen.size.width * 0.8),
+ height: Math.floor(wndScreen.size.height * 0.8),
resizable: true,
frame: "darwin" === process.platform,
icon: path.join(appDir, "stage", "icon-large.png"),
@@ -924,6 +926,7 @@ app.whenReady().then(() => {
autoplayPolicy: "user-gesture-required" // 桌面端禁止自动播放多媒体 https://github.com/siyuan-note/siyuan/issues/7587
},
});
+ printWin.center();
printWin.webContents.userAgent = "SiYuan/" + appVer + " https://b3log.org/siyuan Electron " + printWin.webContents.userAgent;
printWin.loadURL(data);
printWin.webContents.on("will-navigate", (nEvent) => {
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts
index f3bdf0fe02..d4aed231ec 100644
--- a/app/src/protyle/export/index.ts
+++ b/app/src/protyle/export/index.ts
@@ -383,7 +383,7 @@ const renderPDF = async (id: string) => {
})
}
const renderPreview = (data) => {
- previewElement.innerHTML = '<div style="padding:0" class="protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}">' + data.content + '</div>';
+ previewElement.innerHTML = '<div style="padding:6px 0 0 0" class="protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}">' + data.content + '</div>';
const wysElement = previewElement.querySelector(".protyle-wysiwyg");
wysElement.setAttribute("data-doc-type", data.type || "NodeDocument");
if (data.attrs.memo) {