tags:

views:

59

answers:

2

I have a problem with showing generated PDF. The pdf is saved in dataBase. I'm continuing work of a guy that started work that way, so I need to work that way. There's no problem with saving the file on computer,it's working fine, but I need to show it in new window when it's read from dataBase... And sorry about my English. :)

A: 

More information and some code example would be helpful.

You'll need to set the correct header before outputting to the window.

header('Content-type: application/pdf');
Ólafur Waage
I did that but it still go on windows save form.I try even with: header(' Content-type: "application/pdf" ');header(' Content-Disposition: attachment; filename="name.pdf" ');
A: 
<?
 $pdf=pdf_new();
 pdf_open_file($pdf,"");
 pdf_begin_page($pdf,600,800);

 $font=pdf_findfont($pdf,'Helvetica-Bold','host',0);
 pdf_setfont($pdf,$font,30.0);
 pdf_show_xy($pdf,"Sample Text",50,600);

 pd_set_parameter($pfd,"openaction","fitpage");
 pdf_close($pdf);

 $buf=pdf_get_buffer($pdf);
 $len=strlen($buf);


 header("Content-Type: application/pdf");
 header("Content-Length: $len");
 header("Content-Disposition: inline; filename=sample.pdf");
 echo $buf;
 pdf_delete($pdf);
?>
adatapost
I fix it. I didn't remove "" in header. Now it works. Tnx..