Can I use InAppBrowser to open a PDF within a div?

3,040 views
Skip to first unread message

Heidi Anselstetter

unread,
May 15, 2013, 2:59:14 AM5/15/13
to phon...@googlegroups.com
Hello!

I have a html page, divided in several divs and I want to open a local stored pdf file within such a div.
I do not want to have a "fullscreen" pdf opend, this is what I get when I test the InAppBrowser examples from the docs.

Somewhere in an older post I saw that it was planned to be possible with PG 2.7.0. but I can't find any information for this.

If PG doesn't support this possibility, does anyone know a trick how to get to point where I can open a pdf?
I can right now load a pdf with the iframe tag, but I can't scroll the pdf and I only see half of the page, the end of the pdf pages are cut off.

Please advice, I am looking urgently for a solution!

Thanks so much!
Heidi

Shazron

unread,
May 15, 2013, 4:51:13 PM5/15/13
to phonegap
Did u try an iframe?


--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Heidi Anselstetter

unread,
May 16, 2013, 3:37:11 AM5/16/13
to phon...@googlegroups.com
Dear Shazron,

I tried to load the pdf within the div containing an iframe.
This works "a little" but I have to scroll the pdf with 2 fingers, which is ok, but not perfect :-)

What do you mean with your answer?
Should I have the main div => containing an iFrame wich loads a page where I load the InAppBrowser calling the pdf?

I will try that! Or did I understand you wrong?

Thanks
Heidi
Message has been deleted

J.D. Schuitemaker

unread,
May 16, 2013, 8:36:41 AM5/16/13
to phon...@googlegroups.com
Coincidentally, yesterday I created a wish to make it possible to control placement and height/width for the InAppBrowser. Maybe a couple of votes could make this happen?

https://issues.apache.org/jira/browse/CB-3397

Heidi Anselstetter

unread,
May 16, 2013, 9:49:11 AM5/16/13
to phon...@googlegroups.com
That means, that it is currently not possible at all to load a pdf within a html page?
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/sbs_r4YTi2s/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.

Shazron

unread,
May 16, 2013, 12:08:40 PM5/16/13
to phonegap
Having the div as a container for the iframe shouldn't matter.

Heidi Anselstetter

unread,
May 16, 2013, 12:39:29 PM5/16/13
to phon...@googlegroups.com
Dear Shazron,

Please forgive me for asking again:

Can I use InAppBrowser for displaying a pdf within an iframe? If yes, how? Is there any example out there to look at?

I highly appreciate your help!
Thanks Heidi
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/sbs_r4YTi2s/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.

Kerri Shotts

unread,
May 16, 2013, 5:07:18 PM5/16/13
to phon...@googlegroups.com
AFAIK, In-app Browser is not written to do what you're asking: the intent is to display a document/website in a new window (filling the screen), without leaving the app.


___________________________________
Kerri Shotts
photoKandy Studios, LLC


Social Media:
          Twitter: @photokandy, http://twitter.com/photokandy
          Tumblr: http://photokandy.tumblr.com/
          Github: https://github.com/kerrishotts
                        https://github.com/organizations/photokandyStudios
          CoderWall: https://coderwall.com/kerrishotts

Apps on the Apple Store:

Books:

Manmade

unread,
May 21, 2013, 5:18:34 AM5/21/13
to phon...@googlegroups.com
Hi Heidi
Yes you can display a pdf in the InAppBrowser, I use this function:
function openInAppBrowser(url)
{
//alert("openInAppBrowser");
    try {

ref = window.open(encodeURI(url), '_blank', 'location=no,enableViewPortScale=yes');//encode is for if you have any variables in your link
    }
    catch (err)    
    {
        alert(err);
    }

And the link that opens the InAppBrowser looks like this:
<a href="#"  onclick="openInAppBrowser('http://www.mypage.com/pdf/mypdffile.pdf');">Open a pdf file </a>

Or if you want to open a pdf file in a iframe, then you have to scale down the page, otherwise the pdf won´t display correctly.
Something like this.
    <div class="theiframewrap">   
<iframe id="theiframeid" class="theiframeid" src="http://www.mypage.com/pdf/mypdffile.pdf" name="theiframeid" scrolling="yes" frameborder="0"></iframe>
    </div>
and the css:
.theiframewrap { 
width: 320px; 
margin:0px; 
padding: 0px; 
position:relative; 
overflow:hidden; 
}
.theiframeid { 
height:30000px;
width:640px;
margin:0px; 

    -ms-zoom: 0.30;
    -moz-transform: scale(0.30);
    -moz-transform-origin: 0 0;
    -o-transform: scale(0.30);
    -o-transform-origin: 0 0;
    -webkit-transform: scale(0.30);
    -webkit-transform-origin: 0 0;

}

Hope it helps.

Michael SBCERA

unread,
Oct 2, 2013, 6:24:16 PM10/2/13
to phon...@googlegroups.com
Any thoughts on an ics file? I have a web page with some seminar links that opens with inappbrowser. When I click on the ics links, nothing..............
Reply all
Reply to author
Forward
0 new messages