Download a file from XData Service

I'm sure I saw an example but can't find it now, and it's not in any of Roger's books as far as I can see.

I have a service that sends back a pdf (the return type is TStream) and I want to know the best way to consume this in a webcore app.

I am using a TXDataWebClient to make the call.

Thanks

There are plenty of topics about this subject here in Support Center:

Thanks, but none quite what I am after.

The example in Roger's book is an example using a VCL app to download the report. I do not want to just expose the url to the pdf as I need to use the validation by passing the JWT through the TXDataWebclient.

I was looking at the webcore Application methods, but not sure they will do what I need,

What do you intend to do with the PDF once Web Core has it? I posted an example that included the ability to print or download the file. Not sure offhand how I'd display it in a form though. Maybe this will give you a few ideas? The PDF bits are closer to the end of this.

2 Likes

Thanks I'll take a look. I was thinking of using straight js and I see you have done so towards the end of the article.

Surprising how much JS is starting to overrun my project these days! And perhaps amusingly, after witnessing decades of heated discussion about how Delphi should never be a case-sensitive language, I'm finding that maybe that wouldn't have been such a bad idea after all ;-)

Yes, as a result of many years with JS I tend to treat Delphi as case sensitive now. The one global law I would implement is that all assignments should use ":=" in every language. The amount of time I waste using := in JS and = in Delphi.....

1 Like