Joppo
Joppo

Reputation: 729

Javascript error when using iframe

My html/javascript code is supposed to show a pdf file within an iframe, see code below.

The code (and other code in the html page) seems to work well when I look at the resulting page in the (chrome) browser (e.g., the pdf files are shown in iframe and i can scroll them); but the console shows (only) this error

Graphics2DResource.PaintImageData: Bad image resource

with the Chrome browser and the error:

Failed to load resource: the server responded with a status of 404 (Not Found)

with the Safari browser.

Why does that error happen? How can I improve the code to avoid displaying this error? (I googled this error message but I only get logged files)

Related code:

var pdfdocwidth = '800';
var pdfdocheight = '1000';

for(var i=0; i<3;i++){
   form += '<tr><td> <div id="filename'+ i + '"> Document 
  <iframe src="'+Staticvars.documentpath[i] +'" width="'+pdfdocwidth+'" 
  height="'+pdfdocheight+'"></iframe>  </div> </td></tr>';
}

Upvotes: 0

Views: 277

Answers (1)

Ricky Stam
Ricky Stam

Reputation: 2126

Not all browsers handle PDFs the same way. I suggest to have a look here : http://pdfobject.com/ it will do exactly what you want.

Upvotes: 1

Related Questions