210 likes | 426 Views
Rendering PDF content in Windows Store apps. Chetan Parulekar Principal Development Manager 3-175. Agenda. Introduction to the PDF APIs Rendering PDF as images Customizing your PDF rendering Best practices Rendering PDF to a DirectX surface. Introduction to the PDF APIs. Demo.
E N D
Rendering PDF content in Windows Store apps Chetan Parulekar Principal Development Manager 3-175
Agenda • Introduction to the PDF APIs • Rendering PDF as images • Customizing your PDF rendering • Best practices • Rendering PDF to a DirectX surface
Demo • Introduction to the PDF APIs – a magazine app
Overview • Implementation derives from the ISO 32000-1 standards • Abstracts away all the format complexity from the developer • Focus is on rendering of PDF content as an image • APIs enable reading scenarios such as magazines • PDF APIs in Windows 8.1 Preview
Demo • Rendering a PDF page in a Windows Store app
In summary • The PDF APIs allow you to render individual pages of a PDF document into streams as images • The default rendering occurs with: • 100% page size • White as the page background color • PNG as the image encoding format • Rendering PDF as images in your app
Working with password-protected PDF files • Use the LoadFromFileAsync(file, password) or LoadFromStreamAsync(stream, password) APIs with the password string parameter • Rest of your code remains the same • Rendering PDF as images in your app
Demo • Rendering PDF content at various zoom levels
In summary • Use PDFPageRenderingOptions along with the RenderToStreamAsync API • Customization options include: • Output resolution • High contrast • Page region to be rendered • Image encoding format • Background color • Customizing the rendering
Demo • A sample app that demonstrates some best practices when using the PDF APIs
Best practices • Use techniques such as UI virtualization to render only pages in and around the view • Hold on to rendered pages if one needs to re-render them • Release pages that are no longer needed • Cancel page renderings that are superseded • Render only required portions of the page • Best practices when using PDF APIs
Demo • Rendering PDF content to a DirectX surface using SurfaceImageSource
Resources • Windows 8.1 Preview Samples • Windows 8.1 Preview: New APIs and features for developers
Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session • Scan this QR codeto evaluate this session and be automatically entered in a drawing to win a prize!