mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(pdf): support landscape mode at note level
This commit is contained in:
parent
658ce103fc
commit
f3a3906db7
@ -299,7 +299,8 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
|
||||
|
||||
const { ipcRenderer } = utils.dynamicRequire("electron");
|
||||
ipcRenderer.send("export-as-pdf", {
|
||||
title: this.note.title
|
||||
title: this.note.title,
|
||||
landscape: this.note.hasAttribute("label", "printLandscape")
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ ipcMain.on("create-extra-window", (event, arg) => {
|
||||
|
||||
interface ExportAsPdfOpts {
|
||||
title: string;
|
||||
landscape: boolean;
|
||||
}
|
||||
|
||||
ipcMain.on("export-as-pdf", async (e, opts: ExportAsPdfOpts) => {
|
||||
@ -73,7 +74,9 @@ ipcMain.on("export-as-pdf", async (e, opts: ExportAsPdfOpts) => {
|
||||
|
||||
let buffer: Buffer;
|
||||
try {
|
||||
buffer = await browserWindow.webContents.printToPDF({});
|
||||
buffer = await browserWindow.webContents.printToPDF({
|
||||
landscape: opts.landscape
|
||||
});
|
||||
} catch (e) {
|
||||
dialog.showErrorBox(t("pdf.unable-to-export-title"), t("pdf.unable-to-export-message"));
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user