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:
parent
3cd937d08f
commit
b99519d86b
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user