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
https://forums.phpfreaks.com/topic/97246-my-header-hurts/
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
https://forums.phpfreaks.com/topic/97246-my-header-hurts/#findComment-498035
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.