Embed PDF generated from Cake Form in a Cake Page?

2007-09-17 Thread Scott Sharkey

Hi All,

I'm using the examples from the Bakery article by Sam Devore to generate 
a PDF file (resume) from a cake form.  This works just fine, if I use 
the PDF layout (header(Content-type:application/pdf), which displays 
the PDF just fine.  BUT, I need to display that PDF in a cake page 
(using IFRAME?, possibly), so that they can then click to save or print 
the result.

I'm thinking (intuitively) that I can put the result in an IFRAME. 
Right now, I'm NOT saving the pdf anywhere (it's returned as a string), 
and I'd like to avoid doing so, but I'm not sure I can.

Suggestions???  Am I better off saving this to a file somewhere, and 
then dealing with having to create temp files and clean them up all over 
the place?

THANKS!
-Scott

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Embed PDF generated from Cake Form in a Cake Page?

2007-09-17 Thread Adam Royle

I did something similar, but with CSV output, not PDF.

I have one action that returns the CSV file with correct headers, etc, eg.

/orders/csv_generate_report

And then you can either link directly to that in the html or iframe and it 
should display fine. If you then need to save the file or whatever (in my 
case, I had to attach to an email) then you just request that url and do 
whatever with it. In my case:

$csv = file_get_contents(Router::url('/orders/csv_generate_report/',true));

Hope that helps.

Adam
- Original Message - 
From: Scott Sharkey [EMAIL PROTECTED]
To: cake-php@googlegroups.com
Sent: Tuesday, September 18, 2007 4:58 AM
Subject: Embed PDF generated from Cake Form in a Cake Page?



 Hi All,

 I'm using the examples from the Bakery article by Sam Devore to generate
 a PDF file (resume) from a cake form.  This works just fine, if I use
 the PDF layout (header(Content-type:application/pdf), which displays
 the PDF just fine.  BUT, I need to display that PDF in a cake page
 (using IFRAME?, possibly), so that they can then click to save or print
 the result.

 I'm thinking (intuitively) that I can put the result in an IFRAME.
 Right now, I'm NOT saving the pdf anywhere (it's returned as a string),
 and I'd like to avoid doing so, but I'm not sure I can.

 Suggestions???  Am I better off saving this to a file somewhere, and
 then dealing with having to create temp files and clean them up all over
 the place?

 THANKS!
 -Scott

 

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---