PDA

View Full Version : FPDF Usiing Extjs 3.2.1



endimion
10 Apr 2012, 11:56 AM
Halo Sir,,,
I want to ask again. please help me again.
how to create PDFreports using FPDF and extjs ??
and I want the PDF open in a newbrowser tab...

Thanx before,,

scottmartin
10 Apr 2012, 12:10 PM
You basically send the info to FPDF (ajax call)
generate the PDF and send it back to the browser (using FPDF on the server, PHP)
Return the PDF
The browser will open the PDF file automatically. (same as if you clicked on a PDF link)

Regards,
Scott.

endimion
10 Apr 2012, 12:20 PM
Can U give me sample Sir...???

scottmartin
10 Apr 2012, 12:37 PM
Example of how to create the PDF, or how to call and return a PDF?

TCPDF/FPDF have many online examples on how to create the PDF




Ext.Ajax.request({
method: 'POST',
url: 'print_report.php',
params : {
report_name: employee_report_name,
},
success: function(xhr) {
// clear mask and display
grid_panel.getEl().unmask();
window.open('pdf/' + employee_report_name + '.pdf');
},
failure: function() {
// clear mask
grid_panel.getEl().unmask();
alert('AJAX ERROR: Unable to print report, please contact support');
}
});

// print_report.php; you code goes here to create PDF


// last line ... close and output PDF document
$pdf->Output('mypdfreport.pdf', 'I'); // I=inline



Regards,
Scott.