Automatically attach Invoice PDF to confirmation receipt based on the gl...

...obal setting
this should be 
$pdfHtml= CRM_Contribute_Form_Task_Invoice::printPDF($contributionID, $pdfParams, $contactId, "confirmpage");