Click here to Skip to main content
13,054,779 members (64,449 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I'm now working with iTextSharp to fill in pdf fields with values. I got it working but everything is based on access from the web. I'm trying to do it via a console app not web responses involved. Below is the code that will open the resulting pdf file from a HttpContext. My question is there an equivalent way to open a pdf for viewing locally without using HttpContext?

var response = HttpContext.Current.Response;
if (!string.IsNullOrEmpty(attachmentFilename))
    response.AddHeader("Content-Disposition", "attachment; filename=" + attachmentFilename);
response.ContentType = "application/pdf";
Posted 14-Sep-11 4:59am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


If you write this dat pdf file will open in user system pdf reader.User get a msg window with options like "open" ,"save".If user clicks open that file is open in pdf reader.

There are somany webcontrols for viewing pdf in webpage locally without showing msg window like as in previous situation.In this case you can just set filepath property of that webcontrol no need to pass your file to user in response object.

You've to show pdf in your webpage only like google docs if we click on view link it shows in google docs with editor.

Am I right .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 14 Sep 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100