Maybe adding the header data in the pdf layout's ctp? 2012/7/26 gloop <[email protected]>: > Its not the pdf application. The question is why cake output a text/html > header. > > > On Thursday, July 26, 2012 7:07:54 AM UTC+2, gua syed wrote: >> >> try to use dompdf >> >> On Thu, Jul 26, 2012 at 6:04 AM, gloop <[email protected]> wrote: >>> >>> Hello, >>> >>> i would like to create a pdf. Now i found this: >>> >>> >>> http://bakery.cakephp.org/articles/kalileo/2010/06/08/creating-pdf-files-with-cakephp-and-tcpdf >>> >>> So i try this example: >>> >>> Step: 1, 2, 3 the same as the example >>> >>> Step 4: >>> >>> function viewPdf() { >>> $this->layout = 'pdf'; //this will use the pdf.ctp layout >>> $this->render(); >>> } >>> >>> Step 5: >>> >>> <?php >>> App::import('Vendor','xtcpdf'); >>> $tcpdf = new XTCPDF(); >>> $textfont = 'freesans'; // looks better, finer, and more condensed than >>> 'dejavusans' >>> $tcpdf->Cell(0,14, "Hello World", 0,1,'L'); >>> echo $tcpdf->Output('filename.pdf', 'D'); >>> ?> >>> >>> When i open function in a browser i get a download popup and i have to >>> choose how i would open the document. The standard software is "firefox". >>> >>> I try >>> >>> echo $tcpdf->Output('filename.pdf', 'D'); >>> >>> and i see many text (like i open the pdf with firefox. I check the http >>> header and see the document is opend with Content-Type: text/html; >>> charset=UTF-8 >>> >>> >>> I try: >>> >>> In the controller $this->header('Content-type: application/pdf'); and >>> header('Content-type: application/pdf'); >>> >>> But i get always the wrong content-type. >>> >>> How i can change the content type? >>> >>> Thanks for help. >>> gloop >>> >>> -- >>> Our newest site for the community: CakePHP Video Tutorials >>> http://tv.cakephp.org >>> Check out the new CakePHP Questions site http://ask.cakephp.org and help >>> others with their CakePHP related questions. >>> >>> >>> To unsubscribe from this group, send email to >>> [email protected] For more options, visit this group >>> at http://groups.google.com/group/cake-php >> >> > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group at > http://groups.google.com/group/cake-php
-- -Carlos -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
