Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome save to PDF custom filename

In Chrome, when hitting Ctrl + P you can choose 'Save to PDF'. The default file name is equal to the title of the html page the user wants to print. Can this be changed, without changing the actual title of the html page? I'd like to have a date & time in the PDF's name, but I don't want the date & time in the title of my html page.

like image 575
Rudey Avatar asked Nov 13 '14 09:11

Rudey


1 Answers

So if you can put a print button in somewhere and link it to a function similar to the following:

function printWithSpecialFileName(){
    var tempTitle = document.title;
    document.title = "Special File Name.pdf";
    window.print();
    document.title = tempTitle;
}
like image 97
Conal Da Costa Avatar answered Oct 07 '22 11:10

Conal Da Costa