Hi Anatoly,
First, thanks for the help. However, that is not the question that I am asking.
With the WebViewer set to full screen mobile mode (type:html5Mobile and mobileRedirect:true), it consumes my entire mobile device screen. Your built in menu (which you mention controlling above) does not have a 'close', 'back', etc. button. Therefore, what is the process for me to add this button so that I can navigate away from my full screen document and back to the rest of my application?
Today I was able to get it to work with MobileReaderControl in type:html5Mobile and mobileRedirect:false mode (so not full screen). Here is what I did:
1. I added the following to MobileReaderControl.html to add my own toolbar button:
<a id="btnBack" data-transition="none" class="mobile-button">
<span class="glyphicons chevron-left">Back</span>
</a>
2. I created a new event named backPressed in WebViewer.js in _viewerLoaded:
viewerWindow.$(iframe.contentDocument).bind
('backPressed displayModeChanged layoutModeChanged zoomChanged pageChanged fitModeChanged toolModeChanged printProgressChanged error',
3. I added the following to MobileReaderControl.js at the beginning of "exports.ReaderControl = function(options) {":
$("#btnBack").click(function () {
alert("Your Code!);
me.fireEvent('backPressed');
});
4. Then in my controller I bind to the event after I create my viewer:
$(function () {
var viewerElement = document.getElementById('pdftronWebViewer');
var myWebViewer = new PDFTron.WebViewer({
...
type: "html5",
mobileRedirect: false,
...
}, viewerElement);
});
$('#pdftronWebViewer').bind('backPressed', function (event, data) {
alert("My Code!!!");
history.back(-1);
});
This works great. I see "Your Code!", then "My Code!", and then it navigates back one page. However, it does not work when I change to "mobileRedirect:true". "Your Code!" appears, but "My Code!" does NOT appear.
I keep thinking that there is something fundamental that I'm still not understanding:
1. Others must also be using this full screen mode. How do they handle navigating out of full screen?
2. Should I not be using events? If so, how do you recommend doing this so it works with full screen mode?
Thanks,
Steve