I want to open headless page to render

0
Hi Team,I have one page that is rendering the 3D object, which is a pluggable widget. While opening manually in the Mendix application, it is rendering. I am looking for a solution where I can run this page in the backend and take a screenshot of the rendered page in the backend. Can anyone help me achieve this in Mendix?I have tried with PDF generator. It is not rendering the 3D object in PDF. any other solution?Thanks & RegardsAchal R
asked
1 answers
0

Hi,


What you are trying to achieve (rendering a page with a pluggable widget and taking a screenshot in the backend) is not directly supported in Mendix, and your observation with the PDF Generator is expected.

Why this does not work

  • Mendix pages (especially with pluggable widgets / 3D rendering) rely on:
    • Browser rendering
    • JavaScript execution
    • WebGL (for 3D)
  • The PDF Generator module:
    • Does not execute full JavaScript
    • Does not support WebGL / 3D rendering

So:

→ Your 3D widget will not render in backend/PDF context

Important limitation

Mendix does not support headless page rendering on the server.

That means:

  • You cannot open a page in backend and render it like a browser
  • You cannot directly take screenshots from server-side Mendix

Option 1: Use a headless browser

Use an external service like:

  • Puppeteer (Node.js)
  • Playwright

Flow:

  1. Expose your Mendix page via a URL (with proper authentication)
  2. From backend (Java action or external service):
    • Open page in headless browser
    • Wait for rendering
    • Capture screenshot

Example (concept):


await page.goto("https://your-app/page");
await page.waitForSelector("#your-3d-widget");
await page.screenshot({ path: "output.png" });

Option 2: Trigger screenshot from client - alternative

If backend is not strictly required:

  • Use a JS library like:
    • html2canvas (limited for 3D)

Note: This may not work well for WebGL/3D content.

Option 3: Generate image from 3D engine directly

If your 3D widget uses:

  • Three.js or similar

Then:

  • Capture canvas directly:

renderer.domElement.toDataURL("image/png");

Send this image to backend.

Recommended Approach

Best and most reliable:

Headless browser (Puppeteer/Playwright)

Because:

  • Fully renders JS
  • Supports WebGL
  • Works exactly like real browser


  • Backend rendering of Mendix pages is not supported
  • PDF Generator cannot render 3D widgets
  • Solution:
    • Use headless browser for screenshot
    • Or capture from client-side canvas



answered