Search code examples
c#asp.netpdfstreamresponse.write

C# - Stream a PDF using Response.TransmitFile() or Response.WriteFile() And then select a page


I want to stream a pdf from a directory on the server using an ASP.NET page. This works fine. The catch is that I want to pass Adobe Open Parameters to land on a specific page.

Adobe has parameters for this: http://url/filename.pdf#page=XX

But, I can't find out how to stream the file rather than call it through a URL and get the #page= param to work.

Anyone ever done this?


Solution

  • For anyone having the same problem, I was able to solve this issue. If you change the content disposition in the Response.AddHeader from attachment to inline, then setup your url as:

    http://url/Downloader.aspx?fileid=XX#page=YY

    This will work. Your aspx page will render the pdf in the browser and the page parameter will navigate to the appropriate page. Hope this helps!