Jump to content

My Header Hurts...


phpretard

Recommended Posts

I am trying to dispaly a pdf doc and I keep getting the good ol' "Can't modify header..."

 

I think I understand the problem in that any header modification should be done before the html output.

 

When I take away Header( "Content-type: application/pdf"); all I get is,

 

%PDF-1.5 %âãÏÓ 17 0 obj <> endobj xref 17 297 0000000016 00000 n 0000007055 00000 n 0000007164 00000 n 0000007637 00000 n 0000007670 00000 n 0000007997 00000 n 0000008559 00000 n 0000008818 00000 n 0000009104  ---- AND MUCH MORE

 

Is there a meta tag that will cover any pdf display on every page?

 

Is there a better way to display a PDF stored in my DB?

 

 

$query = ("SELECT type,content FROM diagram where CNumber=$CNumber"); 
$result = MYSQL_QUERY($query); 
$data = MYSQL_RESULT($result,0,"content"); 
$type = MYSQL_RESULT($result,0,"type"); 
Header( "Content-type: application/pdf");
print $data;

 

PLEASE LET ME KNOW IF THE QUETION ISN'T CLEAR...When I don't thoroughly understand the problem it is difficult to ask the question.

Link to comment
Share on other sites

Think about header() as special kind of echo(). Difference is header must be before any output other echo, printf,etc.

 

Pdf files can't be inlined into html files. If you need access from page to pdf files create link in in html page wich will be pointing to your pdf file (script wich will generate  pdf).

 

If you must have pdf and html on one site you can try frames/iframes but how it will behave is browser+pdfreader dependant.

Link to comment
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.