divadiva Posted January 26, 2009 Share Posted January 26, 2009 Experts, Is there a way to merge two pdf file ? This is the current scenario: I have abc field in database which stores only pdf files. So, whenever I create a pdf file (pdf is generated with all the data) a link is generated which opens up the another pdf file of (pdf stored in abc field(database)).Now,I am intending to embed that pdf file instead of making it as a link.Is it doable??If yes then how? Heres the code: if( strlen($d_row['confi'])>2 || $d_row['confi_file']) { $pdf->SetFont($ft,'B',$fs); $pdf->Write($lh,'Confi'); $pdf->Ln() ; $pdf->Ln() ; $pdf->SetFont($ft,'',$fs); if(strlen($d_row['confi'])>2) { $pdf->Write($lh,dpdf($d_row['confi'])); $pdf->Ln() ; $pdf->Ln() ; } if($d_row['confi_file']) { $pdf->SetTextColor(0,0,255); $pdf->SetFont($ft,'U',$fs); $pdf->Write($lh,$apath . $d_row['confi_file'],$apath . $d_row['confi_file']); $pdf->SetTextColor(0,0,0); $pdf->SetFont($ft,'',$fs); $pdf->Ln() ; $pdf->Ln() ; } } Thankyou in advance for replying. Quote Link to comment https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/ Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 I am not sure how your pdf class works, but it should be doable to embed, it may be a setting in the class, but there is a header call that makes it downloadable, removing that header or making it not get called if a variable is set is your best bet. I cannot recall which header it is, but look at header to find out. Quote Link to comment https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/#findComment-746717 Share on other sites More sharing options...
divadiva Posted January 26, 2009 Author Share Posted January 26, 2009 Thanks for replying : The code uses fdpdf. As suggested, I have found this header from another source: header("Content-type: application/pdf"); header('Content-disposition: attachment; filename=" "');//In my case file name is stored in database .Those files actually location is on webserver. But the file name should come from database.There are huge number of files in the database.Thats where it is getting tricky.Any idea? Quote Link to comment https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/#findComment-746739 Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 Well the content-disposition is what causes the file to be available to download, if you want it inline you would have to remove that and it should show up in the browser. I am not sure if this is what you are looking for or not, but maybe there is a function in fpdf that you can set to "not download" or something similar like that. I am not familiar with it, so I cannot tell you honestly if it is possible. Quote Link to comment https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/#findComment-746742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.