how can i print the pdf file using binarywrite method in asp.i can print the text file using Response.binary write method but i cnat print the pdf files
How to print the pdf file using binarywrite method in asp?
Collapse
X
-
RakulkumarTags: None -
You'll need to set Response.Conten tType to "applicatio n/pdf".
You may also need to supply a dummy filename and set the "content-disposition" header to "attachment ", or "inline", depending on the desired behavior...
The above ASP example is written in CSharp and makes use of the ABCpdf.NET component. I've done this to show how easy it can be to generate a PDF dynamically from within ASP (although any other PDF component should do). Otherwise, trying to manually construct a PDF from scratch is really hard work.Code:<%@ Import Namespace="WebSupergoo.ABCpdf7" %> <% Doc theDoc = new Doc(); theDoc.FontSize = 96; theDoc.AddText("Hello World"); byte[] theData = theDoc.GetData(); theDoc.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", theData.Length.ToString()); Response.AddHeader("content-disposition", "attachment; filename=ExampleSite.pdf"); Response.BinaryWrite(theData); Response.End(); %>
A few PDF components...- ABCpdf.NET http://www.websupergoo.com/
- iTextSharp http://www.itextsoftware.com/
- PDF4NET http://www.o2sol.com/
Comment
Comment