Data fetch from database according to the user's entry in the database table in the pdf format, benefit of using this format for saving our data in compact and secure form, this will help to user to store the data in the file. Here is simple line of code that will help to to code for saving it in the pdf format.
In the usercontroller we have to import some files name like vendor and fpdf,as users can see them in controller. Then in the ctp file we have to use for each function for fetching the values in string form.
App::import('Vendor', 'Fpdf', array('file' => 'fpdf/fpdf.php'));
public function pdf()
$this->layout = 'pdf'; //this will use the pdf.ctp layout
$this->set('fpdf', new FPDF('P','mm','A4'));
$this->set('data', '' );