0
<div id="iframeTestID"> //abritrarily set to 100% w/h
  <iframe src="somePDFLink"></iframe> //I want the PDF loaded to scroll if it is longer than 100% of the screen
</div>

I'm trying to get the iframe to scroll based on the content inside of it. Currently I've had no luck assigning heights to the parent div and the iframe. The best I can get to happen is to scroll to the bottom of the parent's height. It is as though I cannot calculate the height of the content loaded by the iframe, but rather just calculate the height assigned to the iframe box. Is what I'm trying to do impossible?

thisisnotabus
  • 1,949
  • 3
  • 15
  • 31
  • I'm not sure. Does ist work this way: http://stackoverflow.com/questions/9975810/make-iframe-automatically-adjust-height-according-to-the-contents-without-using – Edi G. Aug 21 '14 at 16:10

2 Answers2

0

I did something similar for also pdf. It worked in android, ios and windows phone 7/8. Here is my code:

<iframe id="identifier" src="urltopdf" style="width: 100%; height: 1000px; border: medium none;visibility: visible;"></iframe>

I have it inside a data-role content div, so it takes width from webbrowser. I had no luck determining height of pdf, so just put a big value and it will resize. In my case, there is no more white space after pdf.

Also you could use google reader:

<a href="http://docs.google.com/gview?embedded=true&amp;url=urltopdf.PDF" data-transition="slidedown" class="ui-link-inherit"></a>
Biribu
  • 3,615
  • 13
  • 43
  • 79
  • Using your code, the height did not size. I entered in height: 1000px, which was not long enough, so I switched it to 10000px, which was far too long. It doesn't appear to be sizing to the content of the PDF. – thisisnotabus Aug 21 '14 at 17:37
  • umm... that is strange. I have 3 pages using that right now. Are you using jquery or jquery mobile? – Biribu Aug 22 '14 at 07:16
0

You should be able to do this by using these two libraries together.

David Bradshaw
  • 11,859
  • 3
  • 41
  • 70