views:

170

answers:

1

how can i download html file as pdf using abcpdf in asp.net,c#

+1  A: 

The following ASP.NET example in C# shows how you might create a PDF from a web page and stream it to a web browser...

<% @Page Language="C#" %>
<% @Import Namespace="WebSupergoo.ABCpdf7" %>
<%
Doc theDoc = new Doc();
theDoc.AddImageUrl("http://www.example.com");
byte[] theData = theDoc.GetData();
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF");
Response.AddHeader("content-length", theData.Length.ToString());
Response.BinaryWrite(theData);
Response.End();
%>

Changing content-disposition from 'inline' to 'attachment' will change the behavior.

There's some further information in the product documentation on the Doc.GetData() function that you'll need to be aware of, and you may also find the 'Paged HTML Example' helpful.

AffineMesh94464