Jump to content

URLFrame context bar


FlavioMacedo

Recommended Posts

I'm trying without any success to do this with URLFrame1.

Returns me an ajax error like below:

OB4F.iframe.contentWindow.document.getElementById ("download").style.display = "none";OB4F.iframe.contentWindow.document.getElementById ("secondaryDownload").style.display = "none";OB4F.iframe. contentWindow.document.getElementById ("openFile").style.display = "none";OB4F.iframe.contentWindow.document.getElementById ("secondaryOpenFile").style.display = "none";OB4F.iframe.contentWindow.document. getElementById ("viewBookmark").style.display = "none";OB4F.iframe.contentWindow.document.getElementById ("secondaryViewBookmark").style.display = "none";OB4F.iframe.contentWindow.document.getElementById ("documentProperties ").style.display = "none";

my code is as follows:

procedure TppCotacao.UniFormBeforeShow(Sender: TObject);
var
   lPDFDevice: TppPDFDevice;

begin

   lPDFDevice := TppPDFDevice.Create(nil);
   try
     lPDFDevice.PDFSettings := Compras_Cotacao.PDFSettings;
     lPDFDevice.FileName := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', AUrl, True);
     lPDFDevice.Publisher := Compras_Cotacao.Publisher;
     Compras_Cotacao.PrintToDevices;
     UniURLFrame1.URL := AUrl;
     lPDFDevice.FileName := UniServerModule.StartPath + 'files\' + MainModule.UniMainModule._company_code + '\Work\' + MainModule.UniMainModule._Document + '-C' + '.pdf';
     Compras_Cotacao.PrintToDevices;
     MainModule.UniMainModule._sAnexo1 := lPDFDevice.FileName;
   finally
     lPDFDevice.Free;
   end;
end;

procedure TppCotacao.UniURLFrame1FrameLoaded(Sender: TObject);
begin

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

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

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

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


end;

Link to comment
Share on other sites

  • 1 year later...

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...