Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 5:35 pm (All times are UTC )

 


Forum rules

Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
Posted: Wed Apr 11, 2007 6:36 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Mar 29, 2007 2:31 pm
Posts: 7
I am using fpdf to create a custom invoice for our customers to print.  It appears to be working fine and I save the output from it in $_SESSION['pdf'].  I have put a open/save-as link on the checkout.thankyou page in virtuemart.  Everything appears to be working fine, as the dialog box opens fine and adobe opens up but the pdf throws out an error when it tries to load.

Quote:
Adobe Reader could not open 'invoice.pdf' because it is either not a supported file type or because the file has been corrupted(for exaple, it was sent as an email attachment and wasn't correctly decoded)



Here is the link for the pdf:

Code:
<p>To print your invoice in PDF-form you can <a href="index2.php?page=checkout.thankyou&order_id=134&option=com_virtuemart&action=print_pdf" title="Download Invoice">download it here</a> <img src="hyperlms/lms/images/icons/pdf16.gif" style="vertical-align: bottom;" alt="PDF" />.</p>


Here is the code for opening the pdf:

Code:
if($_GET['action'] == 'print_pdf'){
         
         require_once('administrator/components/com_virtuemart/modules/model/invoiceClass.php');
      
         //Create invoice and store
         $course_invoice = new course_invoice();
         // Store PDF Invoice in _SESSION.
         $_SESSION['pdf'] = $course_invoice->generate_invoice();
         if(get_magic_quotes_runtime()){
            stripslashes($_SESSION['pdf']);
         }
         header('Pragma: public');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Cache-Control: private');
         header('Content-type: application/pdf');
         header('Content-Length: ' . strlen($_SESSION['pdf']));
         
                        // Displays Save As dialog box.
         header('Content-Disposition: attachment; filename="bkcourse_invoice.pdf";');
         
         header('Content-Transfer-Encoding: binary');
         print $_SESSION['pdf'];
         
      }


Any ideas on what might be the problem?  I can't tell if its a Joomla problem or what.  ???


Top
  E-mail  
 
Posted: Thu Jun 14, 2007 11:14 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Thu Sep 14, 2006 8:20 am
Posts: 3
Hi.
Did you succed... i want to try yuur contribution..

I have a problem and i need your help.
I want to generate a simple pdf version of the cart(no user details..... just products in
the cart).
I do not succed..
Please give a hint.


Thanks in advance


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

Quick reply

 



Who is online

Users browsing this forum: Starburst, tnchatmonk and 51 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group