PDO Export Function - PDF Export export data into pdf directly using GOModel helper functions

Description

GOModel export to pdf functions allows to export data to pdf by passing array of data. Data needs to be passed in form of array and optionally you can define name of file to be exported.
Also, You can get data from select query and export data directly using this function.

Function Defination

  
                                void function arrayToPDF($pdfArray, $fileName = "file.pdf") ;
                                

Parameters Details

Details Type Example
$pdfArray - array of data array 2-D array of data
$fileName - optional name of file to be exported string any valid file name like "xyz.pdf"

Examples

  
                                $GOModel = new GOModel(); //create object of the GOModel class
                                /* array to pdf function */
                                $data = array( array("row1col1","row1col2","row1col3","row1col4"),array("row2col1","row2col2","row2col3","row2col4"));
                                $GOModel->arrayToPDF($data);
                              
                            

More Examples

 
                                //Example 1 
                                $records = $GOModel->select("emp"); //get data from table
                                $GOModel->arrayToPDF($records, "emp.pdf");//export it to pdf

                            

Result/Output

By default, it exports pdf file

Debug

Option Details Example
print_r($GOModel->error) Print errors (if any)