Tcpdf on Laravel 3 controller -


good morning. i'm trying generate pdf tcpdf library , bundle. tested basic usage of library on controller this:

public function get_reporte_grupos(){                $pdf = new tcpdf();     $pdf->addpage();     $pdf->setfont('times','b',16);     $pdf->cell(40,10,'hello world!');     $pdf->output('example_001.pdf', 'i'); } 

and output de binary of pdf file:

%pdf-1.7 % 8 0 obj << /type /page /parent 1 0 r /lastmodified (d:20130725101953-04'30') /resources 2 0 r /mediabox [0.000000 0.000000 595.276000 841.890000] /cropbox [0.000000 0.000000 595.276000 841.890000] /bleedbox [0.000000 0.000000 595.276000 841.890000] /trimbox [0.000000 0.000000 595.276000 841.890000] /artbox [0.000000 0.000000 595.276000 841.890000] /contents 9 0 r /rotate 0 /group << /type /group /s /transparency /cs /devicergb >> /annots [ 7 0 r ] /pz 1 >> endobj 9 0 obj <> stream xsn0+[{qw(-ꩀ%^h(uh8r().. , on.

what i'm missing here? don't wanna use html2pdf because kind of files i'm generating way extense , have control of page break in order maths. i'm missing here?

thanks in advance

share|improve question

oh well, gonna delete question, i'll answer if comes same problem. on controller replace

$pdf->output('example_001.pdf', 'i'); 

with

return response::make($pdf->output('example_001.pdf', 'i'), 200, array('content-type' => 'application/pdf')); 

and you'll pdf file.

share|improve answer
    
thank cheluis,you saved day, thought of laravel tcpdf, thought last alternative reescribiri index.php because problem engine blade templates. – user3417572 mar 14 '14 @ 20:29
    
you welcome – cheluis mar 15 '14 @ 15:34

your answer

 
discard

posting answer, agree privacy policy , terms of service.

not answer you're looking for? browse other questions tagged or ask own question.

Comments