IRONSOFTWAREHOME

How to use C# Virtual Viewport and Zoom in IronPDF

Curtis Chau
Curtis Chau
Updated: August 2, 2026

Control viewport and zoom in IronPDF by using the RenderingOptions property to set ViewPortWidth and Zoom values, or leverage preset PaperFit modes for automatic layout handling during HTML to PDF conversion.

In HTML to PDF rendering, the viewport determines how web page layouts are captured in the resulting PDF document. It represents the virtual screen size that the browser uses to render the web page. When working with IronPDF's Chrome rendering engine, understanding viewport settings is essential for achieving accurate results.

Zoom controls the scaling of web page content in the PDF document. Fine-tuning the zoom level adjusts the content size in the PDF, ensuring proper layout and formatting. This feature is particularly useful when handling responsive CSS layouts that must adapt to different page sizes.

Quickstart: Control Zoom and Viewport with IronPDF

Manage zoom and viewport settings in your HTML to PDF conversions using IronPDF. This guide provides a simple code snippet to start scaling HTML content. With minimal code, you can ensure PDFs render correctly while maintaining responsive design elements and desired layouts.

UseChromeDefaultRendering UseResponsiveCssRendering ViewPortWidth UseScaledRendering width margin

  1. 1Install IronPDF with NuGet Package Manager

    PM > Install-Package IronPdf

  2. 2Copy and run this code snippet.

    new IronPdf.ChromePdfRenderer { RenderingOptions = { ViewPortWidth = 1280, Zoom = 1.8 } }
        .RenderUrlAsPdf("https://example.com")
        .SaveAs("zoomedViewport.pdf");
    C#
  3. 3Deploy to test on your live environment

    Start using IronPDF in your project today with a free trial
    arrow pointer

What Are the Paper Fit Modes in IronPDF?

Access the PaperFit field in RenderingOptions to use preset methods for specific rendering types and modes. These modes provide different approaches for rendering HTML content onto PDF pages, similar to techniques used when creating custom paper sizes. Let's examine each PaperFit mode by rendering the Wikipedia main page for comparison.

PaperFit modes handle various content layouts, from standard web pages to specialized documents like receipts or reports. Each mode optimizes for specific use cases, ensuring PDFs maintain the intended design and readability regardless of the source content's original format.

How Do I Use Chrome Default Rendering?

This mode lays out PDF pages as they appear in Google Chrome's print preview. It configures rendering options to match the appearance of a web page when printed from Chrome. The responsive CSS viewport interprets the specified paper size based on its width. Use the UseChromeDefaultRendering method to configure this.

Chrome default rendering maintains consistency with browser print expectations. It works well for standard web pages and documents where you want to preserve the natural content flow as it appears in typical browser print operations. For advanced scenarios involving JavaScript rendering, this mode ensures proper execution and display of dynamic content.

using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Chrome default rendering
renderer.RenderingOptions.PaperFit.UseChromeDefaultRendering();

// Render web URL to PDF
PdfDocument pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Main_Page");

pdf.SaveAs("chromeDefault.pdf");

How Do I Use Responsive CSS Rendering?

In responsive CSS mode, specify a viewport width by passing a value to the UseResponsiveCssRendering method. The default Width is 1280 pixels. The viewport unit is pixel-based, representing a virtual browser viewport for responsive CSS designs. This mode handles modern frameworks and works with Bootstrap and Flex CSS layouts.

Responsive CSS defines HTML rendering based on the ViewPortWidth parameter, scaling content to fit the specified paper size width. This approach suits modern web applications using responsive design principles, ensuring PDFs maintain the intended layout regardless of original viewport size. When working with custom margins, this mode provides precise control over content adaptation to different page dimensions.

using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Responsive CSS rendering
renderer.RenderingOptions.PaperFit.UseResponsiveCssRendering(1280);

// Render web URL to PDF
PdfDocument pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Main_Page");

pdf.SaveAs("responsiveCss.pdf");

My favorite library of this kind is IronPDF. It allows for fast and efficient manipulation of PDF files. It also has many valuable features, like exporting to PDF/A format and digitally signing PDF documents.

Milan Jovanovic

Microsoft MVP

View case study

IronOCR means we can save $40,000 annually from manual processing, while enhancing productivity and freeing up resources for high-impact tasks. I would highly recommend it.

Brent Matzelle

Chief Technology Officer, OPYN

View case study

The IronSuite play a crucial role in our operations. These are tools that increase efficiencies across the business including creating floor plans and improving inventory management.

David Jones

Lead Software Engineer, Agorus Build

View case study

How Do I Use Scaled Rendering?

The UseScaledRendering method mimics Chrome Print Preview behavior for a specified paper size while providing an adjustable zoom level. This method scales content according to the input zoom percentage.

Scaled rendering offers precise control over content appearance in PDFs. Unlike fixed viewport approaches, this method allows dynamic content size adjustment, making it ideal for documents requiring readability at different scales or when preparing PDFs for various display contexts. This technique complements page orientation and rotation settings for optimal document presentation.

using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Scaled rendering
renderer.RenderingOptions.PaperFit.UseScaledRendering(180);

// Render web URL to PDF
PdfDocument pdf = renderer.RenderUrlAsPdf("https://en.wikipedia.org/wiki/Main_Page");

pdf.SaveAs("scaled.pdf");

How Do I Use Fit to Page Rendering?

Fit to page rendering scales content to fit the specified paper size. It measures the minimum HTML content width after rendering and scales it to fit one sheet of paper width where possible. The configurable minimum pixel width ensures correct display and responsiveness to CSS3 layout rules.

This mode handles content that might span multiple pages horizontally. It works well for wide tables, charts, or dashboards that must fit within a single page width. Automatic scaling ensures all content remains visible without horizontal scrolling, making it ideal for generating PDF reports where readability matters.

How Do I Use Continuous Feed Rendering?

Continuous feed rendering creates a single-page PDF that fits all content onto one page, suitable for documents like consumer bills or receipts. The default PDF page width is 80.0 millimeters with 5-millimeter margins. Let's render the 'receipt.html' file to PDF.

Customize page width and margin by passing them as arguments to the UseContinuousFeedRendering(int width, int margin) method for flexibility. This mode creates concise, single-page documents. It generates receipts, invoices, or any document requiring continuous flow without page breaks. Combined with HTML to PDF page break control, you can create sophisticated document layouts for specific requirements.

using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

int width = 90;
int margin = 0;

// Continuous feed rendering
renderer.RenderingOptions.PaperFit.UseContinuousFeedRendering(width, margin);

// Render web URL to PDF
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("receipt.html");

pdf.SaveAs("continuousFeed.pdf");

Ready to see what else you can do? Check out our tutorial page here: Convert PDFs

Frequently Asked Questions

How do I control viewport width and zoom in IronPDF?

You can control viewport width and zoom in IronPDF using the `RenderingOptions` property. Set the `ViewPortWidth` and `Zoom` values to adjust the virtual screen size and scaling of content in the PDF.

What is the purpose of the Chrome default rendering mode in IronPDF?

The Chrome default rendering mode lays out PDF pages to match how they appear in Google Chrome's print preview. It ensures consistency with browser print appearances for standard web pages and works well for dynamic content and JavaScript rendering.

How does the responsive CSS rendering mode work in IronPDF?

The responsive CSS rendering mode specifies a viewport width and scales HTML content to fit the PDF paper size. It adapts to modern frameworks using responsive design principles, ensuring document layouts are maintained across varying viewport sizes.

What is the `PaperFit` feature in IronPDF?

The `PaperFit` feature in IronPDF provides preset methods for rendering HTML content in different formats, like standard web pages or custom documents. It optimizes PDFs for diverse layout types, maintaining design and readability regardless of the content's original format.

How is scaled rendering beneficial in IronPDF?

Scaled rendering provides precise control over PDF content appearance. By allowing dynamic size adjustment, it's ideal for documents needing readability at various scales, complementing features like page orientation and rotation.

What scenarios suit fit to page rendering in IronPDF?

Fit to page rendering is perfect for content that spans multiple pages horizontally, like wide tables or dashboards. It automatically scales content to fit one page's width, ensuring all content remains visible without scrolling.

Can continuous feed rendering be customized in IronPDF?

Yes, continuous feed rendering can be customized by adjusting the PDF page width and margin. This mode is suitable for documents like receipts or invoices, requiring a single continuous page without breaks.

How do I implement minimal workflow steps with IronPDF?

Begin by downloading the IronPDF C# library. Use `RenderHtmlAsPdf` with preconfigured modes, leverage scaling for zoom, and configure 'fit to page' or 'continuous feed' using specific methods like `FitToPage` or `ContinuousFeed`.

What is the benefit of using the `UseContinuousFeedRendering` method?

The `UseContinuousFeedRendering` method creates a single-page PDF accommodating all content, ideal for documents requiring a seamless flow, such as receipts or invoices.

What is the advantage of using `UseResponsiveCssRendering` in IronPDF?

Using `UseResponsiveCssRendering` in IronPDF allows for handling modern web frameworks effectively, ensuring responsive design principles are upheld and that PDFs adapt to differing viewport sizes efficiently.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 20,809,720Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required