Skip to footer content

How to Use Virtual Viewport and Zoom in C#

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.

Further Reading: How to use Virtual Viewport and Zoom

Chipego
Software Engineer
Chipego has a natural skill for listening that helps him to comprehend customer issues, and offer intelligent solutions. He joined the Iron Software team in 2023, after studying a Bachelor of Science in Information Technology. IronPDF and IronOCR are the two products Chipego has been focusing on, but his knowledge of all products is growing daily, as he finds new ways to support customers. He enjoys how collaborative life is at Iron Software, with team members from across the company bringing their varied experience to contribute to effective, innovative solutions. When Chipego is away from his desk, he can often be found enjoying a good book or playing football.