PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Method Write

Namespace TallComponents.PDF.Layout
Class Document

Write PDF document to HttpResponse in Declaritive (push) or Event-Driven mode (pull).

Sets the following headers:


Please check the turorial on differences in the Push (normal) and Pull (low resource, event driven) mode generation. There are some features that change behavior when using Pull-mode.

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 Event-Driven mode. See for an example of Declaritive mode. C# private void Page_Load(object sender, System.EventArgs e) { // Create a document Document doc = new Document(); Section section = new Section(); doc.Sections.Add( section ); // Setup an event handler for Section.Paragraphs.PrintParagraph section.Paragraphs.PrintParagraph += new ParagraphCollection.PrintParagraphEventHandler(PrintParagraph); try { // Write in Event-Driven mode doc.Write( Response, true ); } catch( Exception ex ) { // Do some logging or error reporting here ... } } private void PrintParagraph( ParagraphCollection sender, PrintParagraphEventArgs args ) { TextParagraph text = new TextParagraph(); text.Fragments.Add( new Fragment( "Hello world from ASP.NET!" ) ); args.Paragraph = text; } 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) ' Setup an event handler for Section.Paragraphs.PrintParagraph AddHandler section.Paragraphs.PrintParagraph, AddressOf PrintParagraph Try ' Write in Event-Driven mode doc.Write(Response, True) Catch ex As Exception ' Do some logging or error reporting here ... End Try End Sub Private Sub PrintParagraph(ByVal sender As ParagraphCollection, ByVal e As PrintParagraphEventArgs) Dim text As New TextParagraph text.Fragments.Add(New Fragment("Hello world from ASP.NET!")) e.Paragraph = text End Sub


public Void Write(HttpResponse responseBoolean eventDrivenMode)




HttpResponse response
The HTTP response to write to.

Boolean eventDrivenMode
Write in Event-Driven mode (pull) if true, write in Declaritve mode (push) if false.
Download TallPDF.NET 4.0
We will send you a download link

  • This field is for validation purposes and should be left unchanged.
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.