By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

PDF display from perl script

P: 2
I am using PDF::Create to dynamically create PDF on the fly.
That works.

I end my code with the $pdf->close;

and the pdf file is created.
I now want to display it in a browser. Here is the code I tried.. but i will not work.
Expand|Select|Wrap|Line Numbers
  1. # Wrap up the PDF and close the file to create the PDF 
  2. # File Name is Add_Multi_Digit.pdf
  3.  
  4. $pdf->close; 
  5.  
  6. # everything works to here... file is created 
  7. #  in the same directory as the script
  8.  
  9. # open and display file to browser.
  10.  
  11. open(PDF, "Add_Multi_Digit.pdf") or die "could not open PDF [$!]";
  12. binmode PDF;
  13. my $output = do { local $/; <PDF> };
  14. close (PDF);
  15.  
  16. print "Content-Type: application/pdf\n";
  17. print "Content-Length: " .length($output) . "\n\n";
  18. print $output;
  19.  
Oct 19 '09 #1
Share this Question
Share on Google+
2 Replies


nithinpes
Expert 100+
P: 410
To read from the PDF file, you can make use of PDF::Core module.
Oct 20 '09 #2

P: 2
I don't want to read it. I created it using PDF::Create.
I want to display back to the browser window so the person can print the pdf out or save it to his computer.
Oct 20 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.