Step 4 of 4: Running the Application

In this step, you will run the application and view the hello world.pdf document.

From the Debug menu, select Start Debugging to view the new PDF.

 

The code starts by retrieving the page rectangle, expressed in points. It then adds a one-inch margin around the page (72 points). Finally, the code creates a Font object and calls the C1PdfDocument.DrawString method to write "Hello World!" on the page. This is exactly what you would do if you were writing to a Graphics object in .NET and is what makes PDF for Silverlight so easy to use.

One important thing to remember is that PDF for Silverlight uses a point-based coordinate system with the origin at the top-left corner of the page. This is similar to the default coordinate system used by .NET, but is different from the default PDF coordinate system (where the origin is on the bottom-left corner of the page). In this example, the top left point of the "H" in "Hello World" is located at [1,1].

Because the coordinate system is based on points, rather than pixels, PDF for Silverlight uses Rect, SizeF, and PointF structures, which have members of type float, rather than Rectangle, Size, and Point, which have members of type int.

Congratulations! You have completed the PDF for Silverlight quick start tutorial.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.