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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access