mercredi 3 décembre 2014

How to destroy PDFJS object?


Vote count:

0




I need functionality for book library and for that I have used:-


-



Turn.js



that used for flipbook effect(only 3rd release working, 4th release not working with it, if someone have similar functionality with 4th release of turn.js then please share your code)


-



pdf.js



which convert pdf to html at client side


This is a referance link which I have followed http://ift.tt/15PVxHm


I have modified one function for use that script dynamically which add pdf's path into that function and according to that that books open in popup This is a referance link which I have followed http://ift.tt/15PVxHm


I have modified one function for use that script dynamically which add pdf's path into that function and according to that that books open in popup


here is the js function for that:


function display_book(path){



var url = path;
PDFJS.disableWorker = false;

PDFJS.getDocument(url).then(function(pdfDoc) {
numberOfPages = pdfDoc.numPages;
pdf = pdfDoc;
$('#book').turn.pages = numberOfPages;

$('#book').turn({acceleration: false,
pages: numberOfPages,
elevation: 50,
gradients: !$.isTouch,
// display: 'single',
when: {
turning: function(e, page, view) {

// Gets the range of pages that the book needs right now
var range = $(this).turn('range', page);

// Check if each page is within the book
for (page = range[0]; page<=range[1]; page++) {
addPage(page, $(this));
//renderPage(page);
};

},

turned: function(e, page) {
$('#page-number').val(page);

if (firstPagesRendered) {
var range = $(this).turn('range', page);
for (page = range[0]; page<=range[1]; page++) {
if (!rendered[page]) {
renderPage(page);
rendered[page] = true;
}
};
}
}

}
});


$("button.close").click(function(){
//code for destroy pdfjs object
$(".modal").css({"display":"none"});
});


});


}


on that popup close event, I want to destroy object of PDFJS(for release memory) and in this code turn.js 3rd released version is used and if I replace that version with 4th release then code doesn't work for the same.



asked 40 secs ago







How to destroy PDFJS object?

1 commentaire:

  1. We found your blog was much handy to me! If u keep up the good job I’ll come back at your website
    pdf.js flipbook

    RépondreSupprimer