Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I wish to display a pdf file which is embedded using base64 encoding in an html. Below is the code I have written for this. The pdf file is displayed in Chrome and firefox but not in Internet Explorer .

Any idea how to get it working in IE? Adobe Reader plugin is properly working in IE for me.

<iframe src="data:application/pdf;base64,baseEncodedString"></iframe>

I am not able to paste the base encoded string because of character limits.But it is of size 401676 characters.

share|improve this question
1  
IE has restrictions when it comes to showing elements with base64. Have a look at some of the comments on stackoverflow.com/questions/12791952/… –  putvande Jul 5 '13 at 14:25
add comment

1 Answer

Aside from "it" being a terrible solution, here is what I would do:

<iframe src="/unbase64.php?mime=application/pdf&str=baseEncodedString"></iframe>

and then

<?php
header("Content-Type: " . $_GET["mime"]);
echo base64_decode($_GET["str"]);
?>

Stupid and will probably hit the maximum URL length often, but it works in principle.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.