You'll need to set Response.ContentType to "application/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...
-
<%@ 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();
-
%>
-
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.
A few PDF components...