Jump to content

How To Change TUniPDFFrame Menu Options?


Frederick

Recommended Posts

I use the above component to display my PDF files and I would like to move or hide some menu options for better clarity and reduced ambiguity.

1)   How do I move the "Go To First Page" and "Go To Last Page" menus to next to the other page positioning menus? It is a logical place for them to be.

2)   What is the purpose of the "Open File" menu and can it be hidden?

3)   What is the purpose of the "Current View" menu and can it be hidden?

4)   Can the "Document Properties" menu be hidden?

--
Frederick
(UniGUI Complete - Professional Edition 1.90.0.1508)
 

pdfframe.png

Link to comment
Share on other sites

1 hour ago, Frederick said:

2)   What is the purpose of the "Open File" menu and can it be hidden?

3)   What is the purpose of the "Current View" menu and can it be hidden?

4)   Can the "Document Properties" menu be hidden?

procedure TMainForm.UniPDFFrame1FrameLoaded(Sender: TObject);
begin
  // download button
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("download").style.display = "none"');
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("secondaryDownload").style.display = "none"');

  // open file button
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("openFile").style.display = "none"');
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("secondaryOpenFile").style.display = "none"');

  // view bookmark button
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("viewBookmark").style.display = "none"');
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("secondaryViewBookmark").style.display = "none"');

  // documentProperties
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("documentProperties").style.display = "none"');

end;

 

  • Like 2
Link to comment
Share on other sites

7 hours ago, Sherzod said:

// open file button UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.' + 'getElementById ("openFile").style.display = "none"'); UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.' + 'getElementById ("secondaryOpenFile").style.display = "none"');

Hi Sherzod,

When I added the above code in the OnShow event of the form to hide the "Open File" menu, I received the following Ajax error message:-

 OFB=new Ext.window.Window({id:"OFB_id",retfalse:{},onEsc:Ext.emptyFn,layout:"fit",title:"Print Reports",modal:true,closeToolText:"",maximizable:false,minimizable:false,resizable:false,iconCls:"x-uni-icon-contain",uniFMask:{beforeclose:true},width:977,height:711,x:451,y:129});OFB.nm="OFB";_cdo_("frmReports");frmReports.ajxS=AjaxSuccess;frmReports.ajxF=AjaxFailure;OFB.rootObj=true;frmReports.appRoot="/";_cdo_(null,OFB,"window",frmReports); O103=new Ext.form.Panel({id:"O103_id",border:false,uActive:false,tabItems:new Ext.util.MixedCollection(),layout:"absolute"});O103.nm="O103";_cdo_(null,O103,"form",frmReports);OFB.add(O103); O10B=(function(P0){return Ext.xR("this="+P0.nm+""+_gv_(O103),OFB,"beforeclose");});O10B.nm="O10B";OFB.on("beforeclose",O10B); O10C=(function(P0){_saf_(P0);return Ext.xR("this="+P0.nm+""+_gv_(O103),OFB,"activate");});O10C.nm="O10C";OFB.on("activate",O10C); O10D=(function(P0){return Ext.xR("this="+P0.nm+""+_gv_(O103),OFB,"deactivate");});O10D.nm="O10D";OFB.on("deactivate",O10D);OFB.on("deactivate",function(f){_sdf_(f)}); O10E=new Ext.panel.iframe({id:"O10E_id",border:false,bodyBorder:false,layout:"absolute",ifName:"name_pdfFrame_O10E",items:[{xtype:"component",width:"100%",height:"100%",autoEl: {tag:"iframe",onload:"iframe_load('O10E_id')",name:"name_pdfFrame_O10E",title:"title_pdfFrame_O10E",src:"about:blank",frameborder:"0"}}],style:"border:none;",width:967,height:670,x:0,y:0});O10E.nm="O10E";_cdo_("pdfFrame",O10E,null,frmReports);O103.add([O10E]);uniVars._loginFrm=null;O103.keyprv=true; O116=(function(P0,P1,P2){return Ext.xR("this="+P0.nm+"&w="+P1+"&h="+P2+""+_gv_(O103),OFB,"resize");});O116.nm="O116";OFB.on("resize",O116); O117=(function(P0,P1,P2){return Ext.xR("this="+P0.nm+"&x="+P1+"&y="+P2+""+_gv_(O103),OFB,"move");});O117.nm="O117";OFB.on("move",O117); O118=(function(P0){return Ext.xR("this="+P0.nm+""+_gv_(O103),OFB,"maximize");});O118.nm="O118";OFB.on("maximize",O118); O119=(function(P0){return Ext.xR("this="+P0.nm+""+_gv_(O103),OFB,"minimize");});O119.nm="O119";OFB.on("minimize",O119); O11A=(function(P0){return Ext.xR("this="+P0.nm+""+_gv_(O103),OFB,"restore");});O11A.nm="O11A";OFB.on("restore",O11A);OFB.show("");OFB.retfalse.beforeclose=1;_axy_(OFB);OFB.uniMask={ldMask:false,maskWaitData:false,maskUseMsg:true};OFB.uniMask.targetObj=null;O10E.iframe.contentWindow.document.getElementById ("openFile").style.display = "none";O10E.iframe.contentWindow.document.getElementById ("secondaryOpenFile").style.display = "none";O10E.initIFrame();O10E.setUrl("/uni-1.90.0.1508/pdf.js/web/viewer.html?file=/cache/icaratcontrol_exe/YSPY5xWoYV10474C455/KNXBFK190820065159954.pdf");

The browser is Opera and I am using Windows 10 Professional x 64.

I have not tested the other JS calls.

Link to comment
Share on other sites

3 hours ago, Frederick said:

When I added the above code in the OnShow event of the form to hide the "Open File" menu, I received the following Ajax error message:-

Hi, 

You should use UniPDFFrame OnFrameLoaded event for this!

Link to comment
Share on other sites

7 hours ago, rtalmeida said:

and Disable Print File?

  // print button
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("print").style.display = "none"');
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("secondaryPrint").style.display = "none"');

 

  • Like 1
Link to comment
Share on other sites

  • 9 months later...
15 minutes ago, Sherzod said:

And what is this button?

When read PDF file error, PDF viewer will show "Missing PDF file." and the "More Info" button
The button for "more info" will show the full path of the file, and I want to hidden this information.

But I have tried it out,  with this code can hide the "More Info" button
UniSession.AddJS (UniPDFFrame_Cert.JSName + '.iframe.contentWindow.document.'  + 'getElementById ("errorShowMore").style.display = "none"');

  • Like 1
Link to comment
Share on other sites

  • 11 months later...
Quote


procedure TMainForm.UniPDFFrame1FrameLoaded(Sender: TObject);

Hi

 

I read my table and load in Unipdfframe ,when the field is null ,the following error is displayed,

Cannot read property 'style' of null

of course if I use below code

procedure TMainForm.UniPDFFrame1FrameLoaded(Sender: TObject);
begin
  // download button
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("download").style.display = "none"');
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("secondaryDownload").style.display = "none"');
.
.
.
Cannot read property 'style' of null
 

 

Reagards.

ErrorPdfframe.jpg

Link to comment
Share on other sites

procedure TfForm1.UniPDFFrame1Loaded(Sender: TObject);
begin

   if UniPDFFrame1.PDFURL > '' then begin

  // download button
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("download").style.display = "none"');
  UniSession.AddJS (UniPDFFrame1.JSName + '.iframe.contentWindow.document.'
       + 'getElementById ("secondaryDownload").style.display = "none"');

   end;

end;

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...