Convert TallPDF.NET 3.0 XML to PDF - Live Demo

XML conversion example form

Edit the following TallPDF.NET 3.0 XML document definition and convert this to PDF online on the server.



Running with TallPDF.NET Professional version 3.0.27.0.

Notes:
  • The resulting document will become available as downloadable document.
    This is intended and done for demonstration purpose. View in browser is also possible.
  • The generated document will have a evaluation notice.

ASPX code

The following ASP definition generates a textarea and submit button, allowing to create the above form.

...
<form method="post" runat="server">
   // Add a text area to allow typing xhtml content
   <textarea name="editor" rows="15" cols="75"> (Default TallPDF.NET 3.0 XML content) </textarea>
   // ...and add the button with an OnClick-event that handles the document generation
   <asp:Button runat="server" text="Show PDF" OnClick="showPDF_Click"></asp:Button>
</form>
                  

C# code

And here is the code fragment that will catch the result from the form and generate the corresponding document.

protected void showPDF_Click(object sender, System.EventArgs e)
{
   TallComponents.PDF.Layout.Document document = new TallComponents.PDF.Layout.Document();

   document.Read (new System.Xml.XmlTextReader(new System.IO.StringReader(Request.Form["editor"])));

   Response.Clear();
   Response.AddHeader("Content-Disposition", "attachment; filename=tallpdf_livedemo_xml.pdf");
   document.Write( Response );
   Response.Close();
}                  
Change the 'attachment;' definition to 'inline;' and the document will be opened in the browser (if viewing in the browser has been enabled in the PDF viewer plugin).