Skip to footer content
USE CASES

Capturing WebGL Maps and 3D Visualizations as PDFs in C#

Interactive maps, 3D dashboards, and model viewers built with WebGL look great in a browser, but stakeholders often need a fixed, shareable version: a map snapshot in a report, a 3D design in an approval packet, a simulation result in an archive. IronPDF captures GPU-accelerated WebGL content as a static PDF in C#, preserving the visual state of the scene at the moment it renders.

The Business Problem

A logistics tool shows routes on a Mapbox map, a real estate app displays 3D terrain, an engineering app renders a CAD model in the browser. Each needs a PDF version for a report, a record, or a recipient who does not have access to the live application. A normal screenshot is low quality and manual, and standard HTML-to-PDF rendering does not capture WebGL, which depends on the GPU.

Configuring the Render

WebGL capture needs three settings: single-process mode, hardware GPU mode, and a delay so the scene finishes rendering before capture.

using IronPdf;

// Required for WebGL: GPU operations must complete in one process
IronPdf.Installation.SingleProcess = true;
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Hardware;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Give the 3D scene time to load and render
renderer.RenderingOptions.WaitFor.RenderDelay(5000);

PdfDocument pdf = renderer.RenderUrlAsPdf("https://docs.mapbox.com/mapbox-gl-js/example/geojson-layer-in-slot/");
pdf.SaveAs("webgl.pdf");
using IronPdf;

// Required for WebGL: GPU operations must complete in one process
IronPdf.Installation.SingleProcess = true;
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Hardware;

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Give the 3D scene time to load and render
renderer.RenderingOptions.WaitFor.RenderDelay(5000);

PdfDocument pdf = renderer.RenderUrlAsPdf("https://docs.mapbox.com/mapbox-gl-js/example/geojson-layer-in-slot/");
pdf.SaveAs("webgl.pdf");
Imports IronPdf

' Required for WebGL: GPU operations must complete in one process
IronPdf.Installation.SingleProcess = True
IronPdf.Installation.ChromeGpuMode = IronPdf.Engines.Chrome.ChromeGpuModes.Hardware

Dim renderer As New ChromePdfRenderer()

' Give the 3D scene time to load and render
renderer.RenderingOptions.WaitFor.RenderDelay(5000)

Dim pdf As PdfDocument = renderer.RenderUrlAsPdf("https://docs.mapbox.com/mapbox-gl-js/example/geojson-layer-in-slot/")
pdf.SaveAs("webgl.pdf")
$vbLabelText   $csharpLabel

The result captures the map, chart, or model exactly as it appeared, suitable for documentation, reports, and archival.

Points to Plan For

This feature carries real environment requirements, and they decide whether it fits a given deployment.

  • A real GPU is required: Hardware GPU mode is mandatory. Software rendering cannot handle shaders, textures, and 3D transforms, so the host needs a compatible GPU with current drivers.
  • Docker is not supported: WebGL rendering does not work in standard Docker containers, which are headless with limited GPU access. The workarounds are a VM or dedicated GPU-enabled server, a microservice running on a GPU host, or pre-rendering scenes to static images.
  • Output is a snapshot: The PDF preserves the visual state at render time. Panning, zooming, and other interactivity are not retained, which is why this suits documentation and archival rather than interactive delivery.
  • Tune the render delay: Complex scenes need time to load. Values between 3000 and 10000 milliseconds are a reasonable range to test against, since too short clips the render and too long wastes time.
  • Single-process mode is global: It is required here but affects concurrency, which is worth weighing in a high-volume service.

Result

With GPU mode enabled and a suitable host, teams turn live WebGL maps, dashboards, and 3D models into static PDFs that travel into reports and archives. Full configuration and troubleshooting steps are in the render WebGL guide.

Frequently Asked Questions

What is the purpose of using IronPDF to render WebGL content?

IronPDF is used to capture GPU-accelerated WebGL maps, 3D dashboards, and model viewers as static PDFs in C#. This is essential for creating shareable, fixed versions of interactive scenes for reports, approvals, and archives.

Why can't I use standard HTML-to-PDF rendering for WebGL content?

Standard HTML-to-PDF rendering does not capture WebGL content because it relies on the GPU for processing. IronPDF's solution includes GPU-accelerated rendering to capture these complex scenes accurately.

What are the necessary configurations for rendering WebGL with IronPDF?

To render WebGL content with IronPDF, you need to enable single-process mode and hardware GPU mode, and include a render delay to allow the scene to fully load before capture.

Why is a real GPU required for rendering WebGL content with IronPDF?

A real GPU is required because hardware GPU mode is necessary to handle shaders, textures, and 3D transforms. Software rendering cannot process these elements effectively.

Can I use Docker to render WebGL content with IronPDF?

No, Docker is not supported because it is headless and has limited GPU access. Alternatives include using a VM, a dedicated GPU-enabled server, or pre-rendering scenes to static images.

What does the output from IronPDF rendering of WebGL content look like?

The output is a static PDF snapshot that preserves the visual state of the WebGL scene at the time of rendering. It is suitable for documentation and archival, but does not retain interactivity like panning or zooming.

How should I tune the render delay for WebGL content?

The render delay should be set between 3000 and 10000 milliseconds depending on the complexity of the scene. This ensures enough time for the scene to load without unnecessarily slowing down the process.

What impact does enabling single-process mode have?

Enabling single-process mode is necessary for WebGL rendering but affects concurrency. This trade-off should be considered, especially in high-volume services.

Where can I find more information on configuring IronPDF for WebGL rendering?

Full configuration and troubleshooting steps can be found in the render WebGL guide available on the IronPDF website.

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

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me