55143681 Posted January 6, 2021 Share Posted January 6, 2021 I use UniPDFFrame to open a PDF file, the file has 5 pages, how to position to the fourth page? Quote Link to comment Share on other sites More sharing options...
azago Posted January 6, 2021 Share Posted January 6, 2021 If you want to use a button to go to a specific page procedure TMainForm.bSetPageClick(Sender: TObject); begin UniSession.AddJS (pdfFrame.JSName + '.iframe.contentWindow.PDFViewerApplication.page=' + IntToStr(UniSpinPage.Value)); end; 1 Quote Link to comment Share on other sites More sharing options...
55143681 Posted January 8, 2021 Author Share Posted January 8, 2021 On 1/6/2021 at 6:33 PM, azago said: If you want to use a button to go to a specific page procedure TMainForm.bSetPageClick(Sender: TObject); begin UniSession.AddJS (pdfFrame.JSName + '.iframe.contentWindow.PDFViewerApplication.page=' + IntToStr(UniSpinPage.Value)); end; thanks ,that works well. And how to move the the first page\the last page\the prior page\the next page? Quote Link to comment Share on other sites More sharing options...
55143681 Posted January 8, 2021 Author Share Posted January 8, 2021 Just now, 55143681 said: thanks ,that works well. And how to move the the first page\the last page\the prior page\the next page? And for c++builder: UniSession->AddJS(UniPDFFrame1->JSName +".iframe.contentWindow.PDFViewerApplication.page="+IntToStr(UniSpinEdit1->Value)); Quote Link to comment Share on other sites More sharing options...
azago Posted January 8, 2021 Share Posted January 8, 2021 Sorry but I only use only and always Delphi (for thirty years ...) and I don't know C ++ anyway in Delphi First Page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("firstPage").click()'); Last page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("lastPage").click()'); Next page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("next").click()'); Previous Page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("previous").click()'); i used unigui for a document solution Angelo 1 Quote Link to comment Share on other sites More sharing options...
huayan889 Posted January 8, 2021 Share Posted January 8, 2021 3 hours ago, azago said: Sorry but I only use only and always Delphi (for thirty years ...) and I don't know C ++ anyway in Delphi First Page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("firstPage").click()'); Last page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("lastPage").click()'); Next page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("next").click()'); Previous Page UniSession.AddJS (uHTMLPDF.JSName + '.iframe.contentWindow.document.' + 'getElementById ("previous").click()'); i used unigui for a document solution Angelo how use code to print pdf ? Quote Link to comment Share on other sites More sharing options...
azago Posted January 8, 2021 Share Posted January 8, 2021 procedure TMainForm.bPrintPDFClick(Sender: TObject); begin MainForm.pdfFrame.JSInterface.JSCall('iframe.contentWindow.print', []); end; 1 Quote Link to comment Share on other sites More sharing options...
azago Posted January 8, 2021 Share Posted January 8, 2021 or UniSession.AddJS (pdfFrame.JSName + '.iframe.contentWindow.document.' + 'getElementById ("print").click()'); 1 Quote Link to comment Share on other sites More sharing options...
huayan889 Posted January 8, 2021 Share Posted January 8, 2021 33 minutes ago, azago said: or UniSession.AddJS (pdfFrame.JSName + '.iframe.contentWindow.document.' + 'getElementById ("print").click()'); Thank Quote Link to comment Share on other sites More sharing options...
55143681 Posted January 8, 2021 Author Share Posted January 8, 2021 2 hours ago, azago said: or UniSession.AddJS (pdfFrame.JSName + '.iframe.contentWindow.document.' + 'getElementById ("print").click()'); Thanks a log,c++ builder code as follow: void __fastcall TMainForm::UniBitBtn1Click(TObject *Sender) { UniSession->AddJS (UniPDFFrame1->JSName + ".iframe.contentWindow.document." + "getElementById (\"firstPage\").click()"); } //--------------------------------------------------------------------------- void __fastcall TMainForm::UniBitBtn4Click(TObject *Sender) { UniSession->AddJS (UniPDFFrame1->JSName + ".iframe.contentWindow.document." + "getElementById (\"lastPage\").click()"); } //--------------------------------------------------------------------------- void __fastcall TMainForm::UniBitBtn3Click(TObject *Sender) { UniSession->AddJS (UniPDFFrame1->JSName + ".iframe.contentWindow.document." + "getElementById (\"next\").click()"); } //--------------------------------------------------------------------------- void __fastcall TMainForm::UniBitBtn2Click(TObject *Sender) { UniSession->AddJS (UniPDFFrame1->JSName + ".iframe.contentWindow.document." + "getElementById (\"previous\").click()"); } //--------------------------------------------------------------------------- void __fastcall TMainForm::UniBitBtn6Click(TObject *Sender) { UniSession->AddJS (UniPDFFrame1->JSName + ".iframe.contentWindow.document." + "getElementById (\"print\").click()"); } //--------------------------------------------------------------------------- void __fastcall TMainForm::UniBitBtn5Click(TObject *Sender) { UniSession->AddJS (UniPDFFrame1->JSName + ".iframe.contentWindow.PDFViewerApplication.page=" + IntToStr(UniSpinEdit1->Value)); } //--------------------------------------------------------------------------- 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.