2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

Configurable destination for Electron PDF

This commit is contained in:
Faris Ansari 2018-10-22 23:26:23 +05:30
parent 3cd937d08f
commit b99519d86b
2 changed files with 9 additions and 3 deletions

View File

@ -17,10 +17,10 @@ async function makePDF(html, filepath) {
await browser.close();
}
async function getPDFForElectron(doctype, name) {
async function getPDFForElectron(doctype, name, destination) {
const { shell } = require('electron');
const html = await getHTML(doctype, name);
const filepath = path.join(frappe.electronSettings.directory, name + '.pdf');
const filepath = path.join(destination, name + '.pdf');
await makePDF(html, filepath);
shell.openItem(filepath);
}

View File

@ -35,7 +35,13 @@ export default {
},
getPDF() {
frappe.getPDF(this.doctype, this.name);
frappe.call({
method: 'print-pdf',
args: {
doctype: this.doctype,
name: this.name
}
});
}
}
}