B4J Question Stream PDF to Browser

KMatle

Expert
Licensed User
Longtime User
I show PDF's on my Website via php/html. For security reasons I don't want to publish the filename/-path. So I stream the pdf file Content to the browser which works fine It's similar to this example:

B4X:
 $data = file_get_contents("http://bar.com/foo.pdf");
  header("Content-type: application/octet-stream");
  header("Content-disposition: attachment;filename=YOURFILE.pdf");

  echo $data;

I want to do the same with B4J. With fx.showexternaldocument you will provide the complete path (which I don't want). Ok, I could copy the pdf to a temp file to show it. So what is the best way to do so? (exactly: How do I "call" the browser with a stream (not file path) or is it better to start f.e. Acrobat Reader directly (as I know it supports streams).
 
Top