I’ve tested this, and it’s working fine for me. (As a bonus, the PDF file takes on the name of the email subject line, so including {{reference}} in the subject line adds the reference number to the PDF file name too. Nifty!)
Note that {{reference}} doesn’t work with Statements – nor should it, since statements are not numbered. @Suohryu, are you sure you’re testing this with Sales Invoices (or Sales Quotes, etc.) and not with Statements?
Also, @Suohryu, are you sure you are using double curly braces and not parentheses or brackets?
i was running 16.2.34, i just updated to the latest version and it still didn’t work, until i edited the template again and then restarted. Suddenly its working.