Jump to content

Keeping PDF Comments?


mikenye

Recommended Posts

Hi all,

 

I have a script that calls and displays PDFs from a folder either as single or compiled into a book.

 

The problem I have is that the original PDFs have comments attatched, when PHP processes them it loses the comment information? Anyone know how I can retain this?

 

heres my script;

 

header("content-type: application/pdf");

$userid=$_GET['uid'];

$filename=buildPdfFromCart($userid);

$fh = fopen($filename,'r');

$data = fread($fh,filesize($filename));

print ($data);

 

function buildPdfFromCart($userid){

global $theDb;

$items=sql("select * from cart where userid=".$userid." order by id");

      if ((mysql_affected_rows($theDb)>0) ){

    while($itemRecord=mysql_fetch_array($items)){

$country=$itemRecord["country"];

$airfield=$itemRecord["airfield"];

$plate=$itemRecord["plate"];

$source=$itemRecord["source"];

if($plate==(integer)-50){

//its a user defined product - so get all the items in this product - they can be either plates or booklets

//country holds the product id

$myproductid=$itemRecord["country"];

$strSQL="select * from myproductitems where myProductId=$myproductid order by id";

$productData=sql($strSQL);

while($itemRecord=mysql_fetch_array($productData)){

$country=$itemRecord["country"];

$airfield=$itemRecord["airfield"];

$plate=$itemRecord["chart"];

$source=$itemRecord["source"];

if($plate==(integer)-99){

//The airfield booklet has been selected - loop through airfield and add all plates

$strSQL="select hy_title from hybrid_charts where hy_country=\"$country\" and hy_airfield=\"$airfield\" order by hy_title";

$plateLink=sql($strSQL);

while($plateData=mysql_fetch_array($plateLink)){

//echo getPlateFilename($country,$airfield,$plateData['chart'],$source)."<br/>";

$platesArry[]= trim(getPlateFilename($country,$airfield,$plateData['hy_title'],$source));

}

}

else{

//echo "'$country','$airfield','$plate','$source'"."$".trim(getPlateFilename($country,$airfield,$plate,$source)).".pdf$<br>";

$platesArry[]= trim(getPlateFilename($country,$airfield,$plate,$source))."";

}

}

 

}else{

if($plate==(integer)-99){

//The airfield booklet has been selected - loop through airfield and add all plates

$strSQL="select hy_title from hybrid_charts where hy_country=\"$country\" and hy_airfield=\"$airfield\" order by hy_title";

$plateLink=sql($strSQL);

while($plateData=mysql_fetch_array($plateLink)){

//echo getPlateFilename($country,$airfield,$plateData['hy_title'],$source)."<br/>";

$platesArry[]= trim(getPlateFilename($country,$airfield,$plateData['hy_title'],$source));

}

}

else{

//echo trim(getPlateFilename($country,$airfield,$plate)).".pdf<br>";

$platesArry[]= trim(getPlateFilename($country,$airfield,$plate,$source))."";

}

}

}

      }else{

}

$pdf =& new concat_pdf('P','mm','A5');

//print_r($platesArry);

$pdf->setFiles($platesArry);

$pdf->concat();

$filename="./outputCharts/test_".$userid.".pdf";

$pdf->Output($filename, 'F');

 

//Now delete the cart and copy the current contents to the history table

$strSQL="delete from cart where userid=$userid";

sql($strSQL);

 

return $filename;

 

 

 

If anyone could help it would be greatly appreciated as im hitting a blank...

 

 

thanks

Mike

Link to comment
https://forums.phpfreaks.com/topic/133055-keeping-pdf-comments/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.