Customizing the Page Rendering

PdfPage’s RenderToStreamAsync method has an overload that enables you to pass a PdfPageRenderOptions instance as a second parameter. This enables you to customize the rendering of any page in a number of ways. PdfPageRenderOptions exposes the following properties:

BackgroundColor—Enables you to choose a different background color rather than the default of white.

BitmapEncoderId—Enables you to use a different encoder for the rendering rather than the built-in PNG decoder. You do this by setting this property to the appropriate Guid.

DestinationWidth and DestinationHeight—Specifies the output image size so you can obtain the appropriate level of crispness. You can specify just one of these, and RenderToStreamAsync ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.