locked
Help, How to download PDF file that comes from the server in Apache Cordova RRS feed

  • Question

  • User1692641958 posted

    Hello friends, I have a website in .Net that returns a pdf, but I can not find the method that in my application of Córdoba when I click on a file but download this file automatically, Any help?

    	[Route("pdf")]
    		[HttpGet]
    		public HttpResponseMessage GetFile()
    		{
    			Request.CreateResponse(HttpStatusCode.BadRequest);
    
    			
    			var rootPath = System.AppDomain.CurrentDomain.BaseDirectory;
    			var fileName = Path.Combine(rootPath, "archivos/pdf", "biologia.pdf");
    			HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
    			response.Content = new StreamContent(new FileStream(fileName, FileMode.Open, FileAccess.Read));
    			response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
    			response.Content.Headers.ContentDisposition.FileName = fileName;
    
    			return response;
    		}

    Friday, April 26, 2019 2:44 PM

All replies

  • User753101303 posted

    Hi,

    A Cordova forum could be better. What happens for now ? It is based on a browser so I believe the user still have to confirm the download. As you don't tell what happens my guess is that you want to skip the download dialog and have this happen without any user action once the link is clicked ???

    Friday, April 26, 2019 3:15 PM