Jump to content
kellyalan

PHP Code / Display .pdf on browser page

Recommended Posts

Hello - I've got this code which is supposed to pull the generated .pdf and display it in the browser.  It was working but in the past few months, has not.  I'm wondering if there's any obvious code error that might be doing this. Any help/guidance appreciated.

 

I've attached a image so you can see what I mean.  The other tabs work (view as HTML on screen, download pdf, email to client)

 

<?php
 
$m_header = '<link href="shared/report.css" rel=stylesheet type="text/css">';
$m_body_tag = ' scroll=no';
require_once($DOCUMENT_ROOT."inc/top-2.inc.php");
 
$i_get_sid = isset($_GET["sid"]) ? (int)$_GET["sid"] : $i_sid;
 
$i_get_pass = isset($_GET["a"]) ? $_GET["a"] : $_SESSION['r_pass'];
$i_get_pass = addslashes($i_get_pass);
 
$i_pdf_file_url = 'report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=/report.pdf';
 
echo '<table cellpadding=0 cellspacing=0 border=0 width="100%">';
echo '<tr vAlign=top><td height=7><img src="images/1x1.gif" width=1 height=7></td></tr>';
echo '<tr height=28 style="background: url(images/bookm-bg.gif) repeat-x"><td width="100%"><nobr>';
echo '<img src="images/1x1.gif" width=5 height=1><a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'"><img src="images/bookm-42.gif" width=67 height=28 border=0></a><img src="images/bookm-s1.gif" width=10 height=28 border=0><img src="images/bookm-51.gif" width=65 height=28 border=0> <a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=/report.pdf"><img src="images/button-downloadpdf.gif" width=80 height=28 border=0></a>  <a href="report.php?sid='.$i_get_sid.'&a='.urlencode($i_get_pass).'&b=email"><img src="images/button-emailpdf.gif" width=80 height=28 border=0></a>';
echo '</nobr></td><td><nobr><font style="font-size: 10px;"><a href="javascript:window.close();">Close Window</a> </font></nobr></td></tr></table>';
 
echo '<p><embed type="application/pdf" src="'.$i_pdf_file_url.'" name="plugin" width=100% height=100% fullscreen=yes style="position: absolute;"></p>';
 
require_once($DOCUMENT_ROOT."inc/btm-2.inc.php");
 
?>
 
 

Share this post


Link to post
Share on other sites

is old. Give a link to the PDF (which you have) and, if you really want to put it on the page, stick it in an

 

Also make sure report.php is outputting the right Content-Type.

Share this post


Link to post
Share on other sites

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.