Batch export / print / send invoices

I’ve build me a small script which does the job for me, here you go guys, have fun :blush:

/**
 * Description
 * This script allows to batch download all invoices within the current page(ination) with the real name of the invoice into your download folder.
 * If you run this script for the first time, your browser will ask you to allow to download multiple files at once.
 * Run through every page and paste this script into the webdeveloper (script) console of your browser.
 * 
 * Usage of this script
 * 1. Replace [ENTER YOUR DOMAIN NAME HERE] with your real domain where InvoicePlane is hosted, f. e.: invoiceplane.mydomain.com
 * 2. Open invoice plane on the page you want to download all pdf files.
 * 3. Paste the script below into the javascript webdeveloper console.
 * 4. Let the magic happen.
 * 
 * If you experience that not all invoices per page (regular 15 invoices per page) are downloaded, you need to increase the timeout (1000 / 1s) to 2000 / 2s or something like that.
 */

(() => {
    document.querySelectorAll('a[href^="https://[ENTER YOUR DOMAIN NAME HERE]/invoices/generate_pdf/"]').forEach((invoice, index) => {
        setTimeout(() => {
            invoice.setAttribute('download', true);
            invoice.click();
        }, index * 1000);
    });
})();