0

I have an object :

<object id="pdfViewer" data="<?=$b64?>" type="application/pdf" title="document" width="100%" height="800"></object>

$b64 is string like this : $b64 = "data:application/pdf;base64,base64 string".

On the first page load, the pdf is displayed in chrome and firefox, not in IE (without errors).

I refresh this object by ajax with this code :

var $pdf = $("#pdfViewer");
$pdf.attr('data','data:application/pdf;base64,'+bin64Corrected);

It works on firefox, not on chrome (it was working in a previous version) and still not IE :D.

I've search for a solution, tried this :

$pdf.load('data:application/pdf;base64,'+bin64Corrected);

It wasn't working.

Thanks for the help !

EDIT

It now works on chrome, I had to change this code to fix the javascript loading part :

newObject = '<object id="pdfViewer" data="data:application/pdf;base64,'+bin64Corrected+'" type="application/pdf" title="document" width="100%" height="800"></object>';
$pdf.parent().append(newObject);

But it's still not working in IE, the only way I can get it working is to do this :

<object id="pdfViewer" data="site/displayPdf" type="application/pdf" title="document" width="100%" height="800"></object>

site/displayPdf is a url that sends pdf bin data with PDF headers.

So does any of you know if it's impossible to load pdf object in IE based on base64 string ?

Thanks !

banibanc
  • 143
  • 3
  • 16

1 Answers1

0

Did you try increasing the Max length of JSON returns?

In your web.config, find this or add it if you don't have it:

<system.web.extensions>
<scripting>
  <webServices>
    <jsonSerialization maxJsonLength="86753090" />
  </webServices>
</scripting>

See if that helps.

Sergio S
  • 194
  • 7