![]() ![]() = new .ContentDispositionHeaderValue("attachment") Result.Content = new StreamContent(stream) Var stream = new FileStream(path, FileMode.Open) HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK) if there is a match then return the file check the directory for pdf matching the certid String fileName = certificateId + ".pdf" Public HttpResponseMessage Post(string certificateId) The controller public class ProductsController : ApiController pdf file in a directory and returns the file if it's found. If you are interested in this compromise, and run into issues implementing it with window.open(), I'll be happy to help.I'm trying to set up a web api service that searches for a. To my knowledge, there is no perfect solution in this case, just a most acceptable solution: open the pdf in a new tab in the browser, if ios has been detected. Having the iPad store the pdf into apps like iBooks will not work, according to this post. I am afraid this may well be the only viable option for you. The provided solution does work, but only when Safari is configured so as not to block popups. If such a solution is acceptable for you, please check this SO post: Is there another way to display the PDF on my iPad without having to embed the file on my website?Īs you are most probably aware, ios devices will not let you download and store a file to memory/disk, as you would do on a desktop/laptop.ĭownloaded items must be opened by an appĪs you are already working on an website, the browser seems a natural candidate.Īs I surmise you do not wish to embed the pdf file inside your website, an alternative would be to open the pdf in a new browser tab. The file is being downloaded to my desktop directly, but this solution does, for some reason, not work in iOS. In AngularJS I would like to get this PDF-file like this: $http.post("api/pdf", object).then(function (results) ) ![]() ![]() HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK) StreamContent pdfContent = PdfGenerator.GeneratePdf() Public HttpResponseMessage Post(CustomType type) ![]() I've this Web API post method to generate a PDF: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |