Jump to content

Recommended Posts

Posted

hi,

 

how can i load picture into TUniURLFrame? I tried next 

 

those two dont work

URLViewer.HTML.Add('<img src="/cache/Workflow_exe/'+ CacheFolder + '/' + Node.Text +'?fake='+ DateTimeToStr(Now) + '" style="width:100%;height:100%">')  //DONT WORK
URLViewer.HTML.Add('<iframe style="width:100%;height:100%;border:none;background-repeat:no-repeat;background-sizecontain;background-image:url(/cache/Workflow_exe/'+ CacheFolder + '/' + Node.Text +'?fake='+ DateTimeToStr(Now) +'");"></iframe>')  //DONT WORK

This one is working but sizes of picture are two big. scrollers appear.

URLViewer.URL:= '/cache/Workflow_exe/' + CacheFolder + '/' + Node.Text +'?fake=' + DateTimeToStr(Now);
  • Upvote 1
Posted

I cant figure it out how to add attachment. There is no where add attachment button. I've searched it all o.O.

 

Basiclly what I want is to be able to insert image in TUniUrlFrame so that it fits. (I've tried width:100%;height:100% (no result)). But if I insert image with this

URLViewer.URL:= '/cache/Workflow_exe/' + CacheFolder + '/' + Node.Text +'?fake=' + DateTimeToStr(Now);

it shows image, but it also show picture in its natural scale, scrollers appear. I want insert image in TUniURLFrame so it fits (without scrollers)

Posted

Hi,

 

I cant figure it out how to add attachment. There is no where add attachment button. I've searched it all o.O.

 

"More Reply Options" button ?

Posted

Hi,

 

Can you try this approach for now ?!:

procedure TMainForm.URLFrameFrameLoaded(Sender: TObject);
begin
  URLFrame.JSInterface.JSCode('try {var _img='#1'.iframe.contentWindow.document.images[0]; if (_img){_img.style["max-width"]="100%"; _img.style["max-height"]="100%";}} catch(e) {};');
end;
Posted

What unit need to add in namespace for JSIntergface. For now it is 

[dcc32 Error] Main.pas(51): E2003 Undeclared identifier: 'JSInterface'

I'm using 0.99.96.1343 version.

Posted

I've updated and try it. It does not work. my code now is:

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  URLFrame.JSInterface.JSCode('try {var _img='#1'.iframe.contentWindow.document.images[0]; if (_img){_img.style["max-width"]="100%"; _img.style["max-height"]="100%";}} catch(e) {};');
end;

procedure TMainForm.btnImageClick(Sender: TObject);
begin
  ShowAttachment('Example.png');
end;

procedure TMainForm.btnPDFClick(Sender: TObject);
begin
  ShowAttachment('3.pdf');
end;

procedure TMainForm.ShowAttachment(AFileName: string);
begin
  URLFrame.HTML.Add('<iframe style="border:none;background-repeat:no-repeat;background-sizecontain;background-image:url(/files/' + AFileName +'?fake='+ DateTimeToStr(Now) +'");"></iframe>')
end;
Posted

Hi,

 

 

I've updated and try it. It does not work. my code now is:

procedure TMainForm.ShowAttachment(AFileName: string);
begin
  URLFrame.HTML.Add('<iframe style="border:none;background-repeat:no-repeat;background-sizecontain;background-image:url(/files/' + AFileName +'?fake='+ DateTimeToStr(Now) +'");"></iframe>')
end;

 

It seems that your HTML is not correct

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