Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# PDF
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";
response.BinaryWrite(contents);
response.End();
Posted 14-Sep-11 5:59am
ehwash838

1 solution

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

Solution 1

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 .
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 Sergey Alexandrovich Kryukov 189
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 14 Sep 2011
Copyright © CodeProject, 1999-2014
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