Jump to content

How to download remote pdf


flexdev

Recommended Posts


Hello,
I have to create a unigui application that has to download pdf files generated by another unigui application sent via unisession.sendfile (which runs on a different server).
If I try to download them directly from the browser I get the correct pdf files, if I try to download them via:
var
  IdHTTP1: TIdHTTP;
  Stream: TMemoryStream;
  Url, FileName: String;
begin
  Url: = 'http://192.168.69.116:8077?callback=PDF';
  Filename: = 'download.pdf';

  IdHTTP1: = TIdHTTP.Create (Self);
  Stream: = TMemoryStream.Create;
  try
    IdHTTP1.Get (Url, Stream);
    Stream.position: = 0;
    Stream.SaveToFile (FileName);

  finally
    Stream.Free;
    IdHTTP1.Free;
  end;
i get not the pdf but a text file.
Where am I doing wrong?

Thank's in advance.

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