Save and (pdf generate) in same process

I have a ‘modal’ widget (extension) with two functions named “renderPrintButton” and “renderSubmitButton” inside:




public function renderPrintButton(){

            if($this->printButton == true){

                return '<button id="button_print_'.$this->formID.'" type="button"  onclick = "$(\'#'.$this->formID.'\').submit()" class="btn blue-chambray"><i class="fa fa-print"></i> '.$this->BttnPrintLabel.'</button>';

            }

        }

public function renderSubmitButton(){

            if(isset($this->formID)){

                return '<button id="button_submit_'.$this->formID.'" type="button" onclick = "$(\'#'.$this->formID.'\').submit()"  class="btn btn-primary">'.$this->BttnOkLabel.'</button>';

            }

        }



from outside, when I draw the widget, pass to it the form ID … how can I implement your solution ?

tnx :mellow: