dynamics al - Expose a BLOB (pdf file) as a downloadable URL in Business Central - Stack Overflow

My question applies to Business Central.I have got a PDF file stored in my database. I want to store t

My question applies to Business Central.

I have got a PDF file stored in my database. I want to store the file somewhere (preferably same domain to prevent CORS errors), so it will be accessible from my javascript code (part of my addin control).

I tried a custom API, but I didn't find a way to build the response with the content of my file. It would be great if it could work that way. Here is the code snippet:

procedure Get(): HttpResponseMessage
var
    OutStr: OutStream;
    Response: HttpResponseMessage;
begin
    Rec.Data.CreateOutStream(OutStr);
    Response.Headers.Clear();
    Response.Headers.Add('Content-Type', 'application/pdf');
    Response.Headers.Add('Content-Disposition', 'inline; filename="Invoice.pdf"');
    Response.Body(OutStr); // <--- No way to set the body content!
    exit(Response);
end;

If it can't be done that way, how can I achieve this?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745296158a4621155.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信