|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 ![]() |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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- |
|
#5
|
|||
|
|||
|
i was running under windows platform and i'm using iis as my webserver
thnks!!!!!!!!!! madhu |
|
#6
|
||||
|
||||
|
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.
|
|
#7
|
|||
|
|||
|
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 |
|
#8
|
||||
|
||||
|
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.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > dynamic creation of PDF files using PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|