Print Sales Invoice to PDF file from code

You can print an existing Sales invoice to a PDF file named as SalesInvoice_<InvoiceId>.pdf through the following code, regardless of how the Print Management setup of Sales Invoice might look like: