i want just to give you more info that can help you todo this task . the TCPDF wrapper support saving file to a local folder , so basically you didn't need to code any thing to save the output , what you need is just a code like this
Loader::loadComponents($this, array("SettingsCollection", "Upload"));
$temp = $this->SettingsCollection->fetchSetting(null, Configure::get("Blesta.company_id"), "uploads_dir");
$upload_path = $temp['value'] . Configure::get("Blesta.company_id") . DS . "pdf_files" . DS;
// Create the upload path if it doesn't already exist
$this->Upload->createUploadPath($upload_path, 0777);
$this->pdf->Output($upload_path . $name . "." . $this->getFileExtension($this->mime_type), 'F');this code will save the files to the upload folder inside the c ompany folder , in pdf_files folder .you can customise more to add a subfolder fot the dates of the generated invoice .