Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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?

C#
var response = HttpContext.Current.Response;

if (!string.IsNullOrEmpty(attachmentFilename))
    response.AddHeader("Content-Disposition", "attachment; filename=" + attachmentFilename);

response.ContentType = "application/pdf";
response.BinaryWrite(contents);
response.End();
Posted

1 solution

Hi

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 .
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900