To choose specific pages for printing using Selenium (Chrome):
// Set the page range for printing
var printSettings = {
pageRanges: '1-5' // Change the page range as required
};
// Set the print options
var options = {
printBackground: true,
pageSize: 'A4',
landscape: false,
marginTop: 20, // Change the margin values as required
marginBottom: 20,
marginLeft: 20,
marginRight: 20
};
// Print the current page
window.printWithRange(printSettings, options);
pageRanges
value with the desired page range to print. For example, 1-5
will print pages 1 to 5, while 3
will print only page 3.window.printWithRange()
function to print the current page with the specified settings.Asked: 2023-06-15 23:05:46 +0000
Seen: 7 times
Last updated: Jun 15 '23