mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
Merge pull request #827 from frappe/fix_electron_printpdf_bug
Fixing printToPDF from electron window
This commit is contained in:
commit
641ffac7fe
@ -20,14 +20,12 @@ export async function saveHtmlAsPdf(
|
|||||||
|
|
||||||
const printWindow = await getInitializedPrintWindow(htmlPath, width, height);
|
const printWindow = await getInitializedPrintWindow(htmlPath, width, height);
|
||||||
const printOptions = {
|
const printOptions = {
|
||||||
marginsType: 1, // no margin
|
margins: { top: 0, bottom: 0, left: 0, right: 0 }, // equivalent to previous 'marginType: 1'
|
||||||
pageSize: {
|
pageSize: {
|
||||||
height: height * 10_000, // micrometers
|
height: height / 2.54, // Convert from centimeters to inches
|
||||||
width: width * 10_000, // micrometers
|
width: width / 2.54, // Convert from centimeters to inches
|
||||||
},
|
},
|
||||||
printBackground: true,
|
printBackground: true,
|
||||||
printBackgrounds: true,
|
|
||||||
printSelectionOnly: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = await printWindow.webContents.printToPDF(printOptions);
|
const data = await printWindow.webContents.printToPDF(printOptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user