Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: HTML PHP MySQL IFrame
 <iframe src="; ?>&embedded=true" style="width:608px; height:700px;" frameborder="0"></iframe>

The above iframe code, displays pdf on the browser.
But my problem is, I have uploaded the pdf to the database(BLOB) and to be able to download the pdf - the link would be something like 
and if i add above url in iframe google viewer, it never recognize is parameter.
<iframe src=" ; ?>&embedded=true" style="width:608px; height:700px;" frameborder="0"></iframe

So what's the best way to be able to view the pdf on the browser, using same technique or something else -
The below code downloads the pdf
header("Content-type: $this->type");
header("Content-Disposition: attachment; filename=$this->name");
echo $this->content;
Is there anything i can change in this code to force it to open in the same browser instead of download?
Posted 20-Jul-12 4:45am
AndyInUK at 20-Jul-12 11:58am
No php/mysql/html guru here??
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

YOu shoudl search codeproject for this question.... For instance: Blend PDF with Silverlight
The solution is quite complicated though.....
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I am interested to know about your server is it online? can I access it? or it just a local machine? if this is a local machine then it is sure that google server wont be able to get the pdf.
When a client send a request to server it does not know what is going to be replied from server. server can give some direction to client but server cant force client. Server can inform client application that it is sending a pdf. but if client application choose to open pdf file on her application or want to save on local machine then she can. But it depends whether your server is accessible to outside world or not. And whether you mention to google server to download or just to view it would download anyway in order to do processing.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I created a (private, used by us in the timetable dept) alternative timetable viewing system for a college I worked at a couple of years back. This would display pdfs inside Iframes too. The code that I had was considerably shorter for embedding the pdf.
Basically, the JS would construct the following html for the pdf's iframe.
<iframe src="pdfTimetable.php?id=12345678&type=student" width="700px" height="500px"></iframe>
The underlying database has since been damaged, however I was able to test the code earlier this year with my android and desktop browsers, the behaviour was still the same as it was 2 years ago, when tested with Chrome, FF, IE 6,7,8.
Which browser(s) are you testing with?
Also, I think the term you're looking for is uploads. As in - "The below code downloads the pdf" --> "The below code uploads the pdf (to the client machine, from the server)"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 445
1 Sergey Alexandrovich Kryukov 322
2 Maciej Los 275
3 CHill60 195
4 King Fisher 179
0 OriginalGriff 240
1 Maciej Los 95
2 Sascha Lefévre 85
3 King Fisher 70
4 F-ES Sitecore 55

Advertise | Privacy | Mobile
Web03 | 2.8.150331.1 | Last Updated 26 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100