Class VirtualPaperLayoutManager
Manages HtmlToPdf page layout behavior when rendering HTML to PaperSize.
Provides options for Responsive CSS, Zoom, Fit-To-Page and Continuous feed printing options that are not available in standard Chrome.
Only one option may be selected at a time.
Inheritance
Namespace: IronPdf.Engines.Chrome
Assembly: IronPdf.dll
Syntax
public class VirtualPaperLayoutManager : Object
Reach for VirtualPaperLayoutManager to control how the Chrome engine fits rendered HTML onto the configured PaperSize, the strategy object behind the PaperFit field on ChromePdfRenderOptions. It owns the five layout methods that pick the fit behavior for a render. C# code never constructs it directly. Instead, callers reach an existing instance through renderer.RenderingOptions.PaperFit and invoke one of its Use* methods.
VirtualPaperLayoutManager exists because Chrome's native print pipeline only offers one layout style. Production PDF workflows need more: a responsive-CSS pass for modern dashboards, a fit-to-page scale for wide tables, a zoom percentage for legibility, and a continuous-feed mode for receipts and bills. The class exposes those four extras alongside the Chrome default in one place, so the choice of layout is a single method call rather than a tree of flags scattered across the renderer. Only one mode may be active per render, because each Use* method overwrites the previous selection.
The five methods on VirtualPaperLayoutManager, grouped by purpose, are: UseChromeDefaultRendering() for browser-style print preview behavior, UseResponsiveCssRendering(int ViewPortWidth = 1280) for responsive layouts driven by a virtual viewport, UseScaledRendering(int ZoomPercentage = 100) for Chrome-default behavior with an extra zoom factor, UseFitToPageRendering(int MinimumPixelWidth = 1) for scaling wide content down to a single sheet width, and UseContinuousFeedRendering(double width = 80, int margin = 5) for single-page output sized in millimeters. The canonical call site is on the renderer's options object, never on a fresh instance. See the viewport and zoom how-to for side-by-side rendered output of each mode.
using IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Active configuration: responsive CSS with a 1280px virtual viewport.
renderer.RenderingOptions.PaperFit.UseResponsiveCssRendering(1280);
// Alternatives (uncomment one; only the last call takes effect):
// renderer.RenderingOptions.PaperFit.UseChromeDefaultRendering();
// renderer.RenderingOptions.PaperFit.UseScaledRendering(120);
// renderer.RenderingOptions.PaperFit.UseFitToPageRendering(1024);
// renderer.RenderingOptions.PaperFit.UseContinuousFeedRendering(80, 5);
PdfDocument pdf = renderer.RenderUrlAsPdf("https://example.com");
pdf.SaveAs("layout-managed.pdf");For the responsive case, pair UseResponsiveCssRendering with the responsive CSS how-to, which covers CssMediaType and print-versus-screen rules. For non-default sheet dimensions used alongside PaperFit, see the custom paper size guide.
Methods
UseChromeDefaultRendering()
Lays out PDF pages in the same way as when viewed from Google Chrome's print preview.
Responsive CSS viewport is interpreted based on the width of the PaperSize. To change this responsive behavior use UseResponsiveCssRendering(Int32)
Declaration
public void UseChromeDefaultRendering()
UseContinuousFeedRendering(Double, Int32)
Creates a single page PDF which will force its entire content's width and height to fit into one page. Can be used for a consumer bill or receipt.
Declaration
public void UseContinuousFeedRendering(double width = 80, int margin = 5)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | The width in millimeters to apply to the PDF page. Default is 80 |
| System.Int32 | margin | The margin in millimeters to apply to the PDF page. Default is 5 |
UseFitToPageRendering(Int32)
Scales content to fit the specified PaperSize. This mode measures minimum HTML content width after it is rendered by the browser, and then scales that content to fit to 1 sheet of paper wide where possible.
A minimum width can be set to control scaling and also to ensure that responsive CSS rules are correctly applied.
Declaration
public void UseFitToPageRendering(int MinimumPixelWidth = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | MinimumPixelWidth | A pixel based minimum width for the document. Can help HTML elements to display correctly and respond appropriately to CSS3 responsive layout rules. |
UseResponsiveCssRendering(Int32)
Uses Responsive CSS to define the rendering of the HTML based on the ViewPortWidth parameter.
Content will attempt to scale the rendered content content to fill the width of the PaperSize.
\Set CssMediaType to choose between paper and screen CSS interpretations.
Declaration
public void UseResponsiveCssRendering(int ViewPortWidth = 1280)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | ViewPortWidth | A pixel based virtual browser viewport for responsive CSS designs. |
UseScaledRendering(Int32)
Adopts a layout which behaves in the same way the 'Chrome Print Preview' does for a given paper size, with an additional zoom level applied to allow content to be manually scaled by the developer.
Responsive CSS is interpreted based on the width of the PaperSize
Declaration
public void UseScaledRendering(int ZoomPercentage = 100)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | ZoomPercentage | A percentage based scale factor on the HTML document. |