Skip to footer content

How to Use Virtual Viewport and Zoom in C#

Unlock the full potential of IronPDF by mastering virtual viewport and zoom features in your C#.NET applications, ensuring pixel-perfect HTML to PDF conversions tailored to your specific rendering needs—watch now and elevate your PDF generation skills!

In this comprehensive tutorial, we explore the use of virtual viewport and zoom features within IronPDF for a C#.NET application. The first step involves ensuring the IronPDF package is installed in your project using the NuGet package manager. Once set up, you need to import the IronPDF namespace into your Program.cs file and set the appropriate license key.

Start by instantiating the Chrome PDF renderer and configuring the rendering options. The tutorial demonstrates rendering the Wikipedia main page URL to a PDF using Chrome's default settings, saving it as chromeDefault.pdf. This setup uses default viewport and zoom settings for CSS rendering. For responsive CSS rendering, the viewport width is set to 1280 pixels, resulting in a PDF saved as responsiveCSS.pdf.

The tutorial further guides on creating a scaled rendering by setting a scale factor of 1.8, saving the output as scaled.pdf. For fit-to-page rendering, options are adjusted to fit content to the page, resulting in fit-to-page.pdf. Lastly, for continuous feed rendering, the continuous feed mode is used, saving the result as continuousFeed.pdf.

The application is run to showcase the various PDFs generated, each tailored to specific rendering needs, ensuring pixel-perfect accuracy. By following these steps, users can effectively leverage virtual viewport and zoom features in IronPDF for HTML to PDF conversions. The tutorial concludes with an invitation to explore more advanced functionalities of IronPDF, encouraging users to sign up for a trial and experience the software's capabilities.

Related Videos