azago Posted October 16, 2019 Share Posted October 16, 2019 Is it possible to press UniButton to know the current page of the pdf displayed in a UniPDFFrame using JS ? in the viewer.js i see key: 'page', get: function get() { return this.pdfViewer.currentPageNumber; }, set: function set(value) { this.pdfViewer.currentPageNumber = value; } or in internet i found iFrame.contentDocument.getElementById('pageNumber').value but I can't use it in a call js Thanks Angelo Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 16, 2019 Share Posted October 16, 2019 2 hours ago, azago said: Is it possible to press UniButton to know the current page of the pdf displayed in a UniPDFFrame using JS ? Maybe you wanted something like this: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniPDFFrame1.JSInterface.JSCode('if ('#1'.iframe&&'#1'.iframe.contentDocument.getElementById("pageNumber")){alert('#1'.iframe.contentDocument.getElementById("pageNumber").value)};'); end; Quote Link to comment Share on other sites More sharing options...
azago Posted October 16, 2019 Author Share Posted October 16, 2019 Thanks Sherzod, the code works well !! Now I have tried to execute a command to go to a page of the pdf through code js using this command (take from https://stackoverflow.com/questions/31615248/pdf-js-changing-current-page-number-programmatically) MainForm.pdfFrame.JSInterface.JSCode('if ('#1'.iframe&&'#1'.iframe.contentDocument.getElementById("docIframe")){'#1'.iframe.contentDocument.getElementById("docIframe").contentWindow.PDFViewerApplication.page=' + Uniedit1.Text +' };'); but not work (I'm a little poor in java). any ideas on how to do it? Thanks as always Angelo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.