Jump to content

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/#findComment-746717
Share on other sites

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?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/#findComment-746739
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/142497-creating-pdf-in-php/#findComment-746742
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.