Atozed Forums
Pdf download in android browser - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Pdf download in android browser (/thread-2767.html)



Pdf download in android browser - Anto90 - 06-15-2022

Hi,
i use a customrestevent in iwbootstrap library (isapi.dll) to download a pdf file from a server. Intraweb version 15.2.48

This is the code

procedure My.BSDownloadAutoDichiarazioneCustomRestEvents0RestEvent(aApplication: TIWApplication; aRequest: THttpRequest; aReply: THttpReply;aParams: TStrings);
begin
  inherited;
  aReply.Headers.Values['Content-Disposition'] := Format('attachment; filename="%s";', [ExtractFileName(NomeFileToDownload)]);
  aReply.SendFile(NomeFileToDownload, True, False);
end;


In chrome and samsung browser add the .html extension to the and i can't open it with the standard adobe reader viewer. (In firefox seems that this does not happen)

In Standalone mode this does not happens.

Thank you for Help

Andrea




RE: Pdf download in android browser - Anto90 - 06-23-2022

(06-15-2022, 02:33 PM)Anto90 Wrote: Hi,
i use a customrestevent in iwbootstrap library (isapi.dll) to download a pdf file from a server. Intraweb version 15.2.48

This is the code

procedure My.BSDownloadAutoDichiarazioneCustomRestEvents0RestEvent(aApplication: TIWApplication; aRequest: THttpRequest; aReply: THttpReply;aParams: TStrings);
begin
  inherited;
  aReply.Headers.Values['Content-Disposition'] := Format('attachment; filename="%s";', [ExtractFileName(NomeFileToDownload)]);
  aReply.SendFile(NomeFileToDownload, True, False);
end;


In chrome and samsung browser add the .html extension to the and i can't open it with the standard adobe reader viewer. (In firefox seems that this does not happen)

In Standalone mode this does not happens.

Thank you for Help

Andrea


Update:

I have resolved by use Webapplication.SendFile('',False) in Async Event. It works as well althought i don't like use it in async event. Is there another method to do better in async event?

 I think use aReply.Headers.Values['Content-Type'] := 'application/pdf' in rest event of iwbsbutton  does not have any effect in isapi.dll. The header is not assigned for the correct download file.


thank you

Andrea