Method Write
Namespace TallComponents.PDF.Layout
Class Document
Write PDF document to a HttpResponse in Declaritive mode.
Sets the following headers:
HeaderValueContentTypeapplication/pdfContentEncodingUTF8
The following snippets demonstrate how to create a simple PDF document and stream it to a browser from the code-behind of an ASP.NET page (.aspx) using Declaritice mode. See for an example of Event-Driven mode. C# private void Page_Load(object sender, System.EventArgs e) { Document doc = new Document(); Section section = new Section(); doc.Sections.Add( section ); TextParagraph text = new TextParagraph(); section.Paragraphs.Add( text ); text.Fragments.Add( new Fragment( "Hello world from ASP.NET!" ) ); try { // Write in Declaritive mode doc.Write( Response ); } catch( Exception ex ) { // Do some logging or error reporting here ... } } VB.NET Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Create a document Dim doc As New Document Dim section As New Section doc.Sections.Add(section) ' Add some content Dim text As New TextParagraph section.Paragraphs.Add(text) text.Fragments.Add(New Fragment("Hello world from ASP.NET!")) Try ' Write in Declaritive mode doc.Write(Response) Catch ex As Exception ' Do some logging or error reporting here ... End Try End Sub
Syntax
public Void Write(HttpResponse response)
Returns
Void
Parameters
HttpResponse
response