ComponentOne PDF for WPF and Silverlight
Step 2 of 4: Adding Content to the Page
PDF for WPF and Silverlight Overview > Getting Started > Quick Start > Step 2 of 4: Adding Content to the Page

In this step you'll add some content to the document using the DrawString method.

In the MainPage.xaml.cs file immediately following the new C1PdfDocument object you created in step 1, add the following code:

To write the code in Visual Basic:

 Protected Overrides Sub OnMouseLeftButtonDown(e As MouseButtonEventArgs)


 ' Add content to the page

 Dim rc As Rect = pdf.PageRectangle

 rc.X = InlineAssignHelper(rc.Y, 72)

 Dim font As New Font("Arial", 12)

 pdf.DrawString("Hello World!", font, Colors.Black, rc)

End Sub

To write the code in C#:

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)

{

     // Add content to the page

     Rect rc = pdf.PageRectangle;

     rc.X = rc.Y = 72;

     Font font = new Font("Arial", 12);

     pdf.DrawString("Hello World!", font, Colors.Black, rc);

}