When user try to put PDF Tron web viewer in landscape mode
from portrait mode, PDF is cutting from bottom.
Please let us know what's issue or where we can fix it.
May be we need to set width and height dynamically as we
are changing mobile mode on run time.
Note :
1. We have set "mobileRedirect: false" in PDFTron.WebViewer .
Thanks,
Anish Jain
$(window).on("orientationchange", function () {
//when using the mobile viewer in an iframe, the orientationchange event is only triggered on the top window.
//the desired height and width of the mobile viewer must be set explicitly.
//if the mobile viewer should take up 100% of the screen space, simply set the iframe content window's innerHeight and innerWidth
//to the top window's respective values.
if ($('html').hasClass("ipad ios7") && Math.abs(window.orientation) === 90) {
//workaround for iOS7 bug where window height is incorrect
//http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue/19449123#19449123
$('#viewerFrame')[0].contentWindow.innerHeight = 672;
} else {
//resize the iframe content
$('#viewerFrame')[0].contentWindow.innerHeight = $(window).height();
}
$('#viewerFrame')[0].contentWindow.innerWidth = $(window).width();
});
I am trying to integrate webviewer with my application. My application has already a HTML page in which webviewer has to be inserted in a div.
Webviewer has to be loaded with a particular page number when any page number on the HTML is clicked. Basically, my application will display a list of page numbers upon search. When clicked on any page number, the book should be loaded with that particular page number.
When i try to integrate the webviewer, I am getting lot of errors. Can you please let me know the exact procedure to display the webviewer in the one div part of my page?
We are trying to buy docpub to convert our pdf book to xod, if i can display it successfully.
Also, is there any way to disable side panel, annotations and highlight the text if i send the word to be searched dynamically from search results?
Thanks,
Shashank
$(function() {
$('#myButton').on('click', function() {
var viewerElement = document.getElementById('viewer');
myWebViewer = new PDFTron.WebViewer({...}, viewerElement);
var $viewerElement = $(viewerElement);
$viewerElement.on('documentLoaded', function() {
myWebViewer.setCurrentPageNumber(4);
})
});
}
You can disable buttons by hiding them through JavaScript or CSS. You could do this in a config file like our samples and the code might look like: $('#rotateButton').hide()
var inner = $('iframe')[0].contentWindow;
inner.$('#fullSearchBox').val("my search term");
inner.$('#caseSensitiveSearch').prop('checked', true);
inner.$('#fullSearchButton').trigger('click');
// disable
$('#prevPage').button('disable');
// enable
$('#nextPage').button('enable');
readerControl.docViewer.SetTextHighlightColor('rgba(255, 0, 0, 0.5)');
var myWebViewer = new PDFTron.WebViewer({
config: "path/to/my/config/file.js",
...
...
}, viewerElement);
var docViewer, currentPage;
$(document).on('documentLoaded', function() {
docViewer = readerControl.docViewer;
currentPage = docViewer.GetCurrentPage();
docViewer.on('pageNumberUpdated', function() {
var newPage = docViewer.GetCurrentPage();
if (Math.abs(newPage - currentPage) > 10) {
// hide the buttons
}
currentPage = newPage;
});
});
...For your other customizations you'll want to use a config file. You can read more about config files in the linked Developer Guide in the "Customization Framework" section. This section also explains how to send custom data through WebViewer to your config file which is what you could do to set the starting page number when the document is loaded. This post has an example and <a href="https://groups.google.com/d/msg/pdfnet-webviewer/3A9XqrYhNeE/JBAC0lTY_PAJ" target="_blank" onmousedown="this.href='https://groups.google.co