PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 29th, 2004, 05:50 AM
sridevi sridevi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 sridevi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wink dynamic creation of PDF files using PHP

Hello,
i 've writen the follwing code for the dynamic creation of PDF files in php but i'm not getting any output(i mean its just giving a blank page).

can any one check my code and help me ..it's really vvvvvv urgent and i was trying hard for this from 2 days
<?
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
if (!pdf_open_file($pdf, "test.pdf")) {
echo error;
exit;
};

pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
$buffer = PDF_get_buffer($pdf);

echo $buffer;
header("Content-Type; Application/pdf");
header("Content-Length;".strlen($buffer));
header("Content-Disposition;inline;filename=test.pdf");
pdf_close($pdf);
pdf_delete($pdf);
echo"<a href=test.pdf>open the file</a>";
?>


thanks in advance!!!!!!!!!!
madhu

Reply With Quote
  #2  
Old July 29th, 2004, 07:04 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
When you say you're getting a blank page, do you mean you're getting a blank html page or a blank PDF page? This may be a stupid question, but do you actually have PDFLIB installed?

I can see potential for your getting a blank page in the first block. If you're unable to open the file, you're echoing error (not "error" or $error) and then exiting. Maybe the code's stopping there because of a permissions issue.
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #3  
Old July 30th, 2004, 01:29 AM
sridevi sridevi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 sridevi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile Fatal error: Call to undefined function: pdf_new()

Sorry!! for giving the wrong code,the actual code was this

<?
$pdf = pdf_new() ;
pdf_open_file($pdf, "test.pdf");
if (!pdf_open_file($pdf, "test.pdf")) {
echo "error";
exit;
}
else {
echo "successfully opened";
}
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
pdf_set_value($pdf, "textrendering", 1);

pdf_get_fontname($pdf);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_save($pdf);
$buffer = PDF_get_buffer($pdf);
echo $buffer;
echo"<a href=test.pdf>open the file</a>";
header("Content-Type; Application/pdf");
header("Content-Length;".strlen($buffer));
header("Content-Disposition;inline;filename=test.pdf");

pdf_close($pdf);
pdf_delete($pdf);
?>

and now i'm getting the error as Fatal error: Call to undefined function: pdf_new()

;extension=php_oracle.dll
extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_printer.dll

Is already done in php.ini file

can u please help me
thanks in advance.

madhu

Reply With Quote
  #4  
Old July 30th, 2004, 03:16 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 5
Are you running this under windows or linux? If its under linux I think you will need to recompile it with pdf support. I could be wrong though.

-KM-

Reply With Quote
  #5  
Old July 30th, 2004, 03:57 AM
sridevi sridevi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 sridevi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

i was running under windows platform and i'm using iis as my webserver

thnks!!!!!!!!!!

madhu

Reply With Quote
  #6  
Old July 30th, 2004, 07:07 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Back to my earlier question, did you ever actually download and install PDFlib? The PHP PDF functions are just hooks into that. There are several other PDF libraries in PHP that don't require PDFlib, though PDFlib is generally speaking a little more powerful and faster.

Reply With Quote
  #7  
Old August 2nd, 2004, 06:52 AM
sridevi sridevi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 sridevi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question error in installing the PDFlib

i 've downloaded the PDFlib but how to install it can u help me
b'oz i'm getting error as could not install

thanks
madhu

Reply With Quote
  #8  
Old August 2nd, 2004, 06:59 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
What's the error? I've never installed it myself, but I suspect it's a matter of installing PDFlib and then if need be recompiling PHP with PDFlib support. The PDFlib documentation should provide all you need to get that installed. I'll be no help on getting this installed on a Windows system -- I just don't know how to admin a Windows box.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > dynamic creation of PDF files using PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway