-1

PDFファイルの読み取りに使用されるphpコードにhtmlタグを追加しようとしています。ページの下部にリンクを追加したいのですが、このリンクpdfファイルの上に表示されます。しかし、これを行う方法が見つかりません。この画像のようなものを作りたい..
ここに画像の説明を入力

PDFファイルを表示するためのインラインスクローラーが必要であり、次に他のPDFファイルへのリンクが必要です。

ここに私のコード:

<?php
$filename=base64_decode($_REQUEST['file2']);
$new_id=base64_decode($_REQUEST['id2']);
$line = "<html>";
$line .= "<head>";
$line .= "<title>PDF test</title>";
$line .= "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
$line .= "</head>";
$line .= "<body><div style='position:absolute; overflow:scroll;height:100px !important'>";
$file = WEB_ROOT."/admin/images/plastic_sandesh/pdffile/".$filename;
$length = filesize($file);
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=".$file);
header("Content-Length: ".$length); 
@readfile($file);

$line .= "</div></body>";
$line .= "</html>";
?>

<iframe style='border:1px solid #FEFEFE; width:100px; height:100px;'>
<div style="position:absolute; overflow:scroll;height:100px !important">
<?php
$Qry2 =mysql_query( "select * from `tbl_plasticsandesh_pages` where `sandesh_id`='$new_id' order by `order`") or die(mysql_error());
$j=1;
 $cnt=mysql_num_rows($Qry2);
while($res2 = mysql_fetch_array($Qry2))
{
    $file_name2=base64_encode($res['pdf_page']);
    ?>
  <a href="readpdf.php?act=view&file=<?php echo $file_name2;?>$id2=<?php echo $_REQUEST['id2'];?>" style="color:#111"><?php echo $j;?></a><br />
<?php
$j++;
}
?>
 </div>
 </iframe>

しかし、問題は唯一のpdfファイルが表示され、他のPDFファイルへのリンクがないことです。

前もって感謝します。

4

2 に答える 2

2

ヘッダーを設定していて、ブラウザーはページを application/pdf として表示します。そのため、リンクは表示されません。

解決策: ページを html ページとして表示し、その上に PDF を iframe で表示します。

于 2013-07-25T07:07:18.370 に答える
0

これを使用して解決します:

<iframe name="iframe1" frameborder="0" src="<?php echo SITE_URL."/admin/images/plastic_sandesh/pdffile/".$filename;?>" height="100%" width="100%">
<html>
<body marginwidth="0" marginheight="0" style="background-color: rgb(38,38,38);">
<embed width="100%" height="" name="plugin" src="<?php echo SITE_URL."/admin/images/plastic_sandesh/pdffile/".$filename;?>" type="application/pdf">
</body>
</html>
</iframe>

次に、リンクとその作業のための別のコード。

于 2013-07-25T09:57:38.310 に答える