Altsoft XML2PDF Formatting Engine ASP.NET connector provides an easy way to generate PDF streams directly from ASP.NET pages in the same way as usual HTML pages. To do this you can dynamically create an XML page in any format supported by Altsoft XML2PDF Formatting Engine and filter it through the Altsoft XML2PDF Formatting Engine. The generated PDF will be streamed to the client application.

ASP.NET developers can enjoy the familiar development framework to create Web solutions that generate and distribute dynamic PDF documents immediately by a client request. In particular, you can code your .aspx pages with XSL-FO, SVG, XHTML or WordML instead of HTML and have a formatted PDF in the response stream. This technique can help you to avoid using stylesheets, templates, transformations and other processes usually required to produce a PDF file and keep working within the standard ASP.NET way by automating a page source.

The ASP.NET connector is distributed as a free add-on to the XML2PDF Formatting Engine .NET API.

The sample below demonstrates how to create a drawing in PDF using SVG as an intermediate format.

Source Code Sample

<?xml version="1.0" encoding="ISO-8859-1"?>
<%@ Page language="c#" AutoEventWireup="false" Inherits="Altsoft.Web.UI.SvgPage" %>
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">
<%
	for( int i=0; i<100; i+=2)
	{
		%><ellipse
			cx="200"
			cy="<%=300-i%>"
			rx="<%=i/1.7+30%>"
			ry="10" fill="none"
			stroke="black"/><%
	}
	%>
</svg>

Source Code Description

<?xml version="1.0" encoding="ISO-8859-1"?>

XML declaration specifies an XML file and the encoding of the page. This declaration must be the first line of the page. Otherwise this file will not be recognized as a correct XML file.

Inherits="Altsoft.Web.UI.SvgPage"

This page inherits the Altsoft’s System.Web.UI.Page overload for SVG. It allows you to work with a web page as an SVG file. And SvgPage will convert it to PDF for you. There are also overloads for XSL-FO, XHTML and WordML pages available.

<svg xmlns=”http://www.w3.org/2000/svg”
xml:space=”preserve” width=”400″ height=”400″>
<%
for( int i=0; i<100; i+=2)
{
%><ellipse
cx=”200″
cy=”<%=300-i%>”
rx=”<%=i/1.7+30%>”
ry=”10″ fill=”none”
stroke=”black”/><%
}
%>
</svg>

SVG tags are mixed with ASP.NET code that produce a dynamic SVG picture.

Altsoft XML2PDF Formatting Engine functionality