-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not render a WebGL image for PDF -- get a black box instead #1731
Comments
What happens if you try to print the page with chrome? |
@onamission I see you try to create pdf right after the networkidle0 event. I'd expect the page with WebGL context to do some async rendering using |
Curious if anyone has solved this since I've ran into a similar issue. Image/PNG generation works just fine but PDF's are showing blanks for a canvas-based map. I can post repo steps here if it makes debugging easier. |
Same problem here so I'll add examples plus link to the actual page in case this would be helpful. The following page renders just fine as screenshot, but the map canvas (Mapbox-gl WebGL) is blank when rendering as PDF: https://dashboards.cluvio.com/dashboards/wx7y-53qr-pv5o/shared?sharingToken=759d96a5-da83-493c-833e-6b8f694a6189 |
FWIW I think this might be a problem deeper downstream since this issue is present in a few libraries. I've created a post on the headless dev group here https://groups.google.com/a/chromium.org/forum/#!topic/headless-dev/BVpTJ4JIR8Q to try and see if it's deeper than just this library |
Some follow up: I've been instructed to create a bug in the Chromium tracker, which is can be found here. I'll keep this thread up-to-date as its status changes. |
I'm having a similar issue except both screenshot and pdf both output as white. If I turn off headless then the screenshot renders as expected and the pdf crashes with the following.
|
@joelgriffith in your Google group comment, you mention that screenshot works - how were you able to at least get screenshot working? I am also trying to get this to work with MapboxGL |
I had better luck with this solution: #1260 (comment), specifically for MapboxGL. |
@allthesignals Hi, I'm trying to run headless with MapboxGL , it works fine in all distributions ,but |
me too. ubuntu server 16.04 (X) Linux mint 18.3 with Cinnamon (√) |
someone have solved this problem? |
Hello, had similar issue running headless chromium on lambda for PDF generation (screenshots were working fine with WebGL but PDF not), solved it by rolling back to |
also on windows platform, puppeteer version 1.5 doesn't render webgl, |
Also with Mac 1.5 webgl in pdf is blank. |
I'm experiencing the same issues in regard to manipulating and outputting a WebGL context via PDF. The process I use it to render a WebGL scene in Chrome headless, export a PNG snapshot using JavaScript, inject that image into the DOM, and then save as both a screenshot and PDF. The whole process is run using a single page within Puppeteer. Here are results from the most recent Puppeteer versions (on Windows): 1.6.1 (HeadlessChrome/69.0.3494.0 - Revision 575458)
1.6.0 (HeadlessChrome/69.0.3477.0 - Revision 571375)
1.5.0 (HeadlessChrome/69.0.3452.0 - Revision 564778)
1.4.0 (HeadlessChrome/68.0.3419.0 - Revision 555668)
As you can see, something happened between |
@robhawkes I had to downgrade to 1.4 because of this issue. I'm rendering mapbox webgl maps in headless chrome. |
@ronalb Coincidentally, that's exactly what I'm doing too! The 1.4.0 downgrade has been workable for me so far, though it's frustrating that it's not possible to use the latest version as things stand. |
@robhawkes yeah ,very frustrating. as from 1.6 some race conditions bugs were fixed. |
@robhawkes just checked on puppeteer 1.7 and it seems to be fixed ! |
@ronalb You got me excited but it still doesn't seem to work for me (1.7.0 using HeadlessChrome/70.0.3508.0), the WebGL context is still blank. Did you do anything different to get it working? |
@robhawkes no I didn't do anything ,but maybe my scenario is different. I also see that you wrote some more info: I think I know the difference , I am not really using the PDF feature , what I do is take an image snapshot,(I had to use some timeout because of mapbox doesn't let me know when the map is loaded) |
I haven't seen a lot of movement on the Chromium side (https://bugs.chromium.org/p/chromium/issues/detail?id=809065), is there any sense on how/when this could be fixed? |
@ianformanek Make sure you're using |
Yeah, this is it! Creating the mapbox-gl instances like this:
fixes the issue when the map would be empty when using puppeteer to render pdf (probably limited to rendering on server without a GPU). It is still interesting that pdf and image behave differently in this regard, but probably has to do with timing. See also mapbox/mapbox-gl-js#6448 Thanks! |
Any update on this thread: The issue is still coming for "puppeteer": "^2.0.0". |
I'm seeing this issue when I try to render a PDF containing a mapbox-gl-js map on the latest release of Puppeteer (5.3.1) on Ubuntu server 18.04 LTS. I've tried using the bundled Chromium version and latest releases of Chrome and Chrome Beta - all give the same result. I've tried setting the If I set
|
I had the same issue with Three.js. A workaround is to use the already-suggested
UPDATE: I ended-up using screenshots instead, since |
For some reason the mapbox issue affects pdf but not screenshots, so my workaround was to replace canvases with screenshots:
|
Any updates? I am still experiencing this on puppeteer: "13.0.0. screenshot works. but pdf doesnt work. I have also noticed that on threejs, when there is no light added to the scene, and the material uses MeshNormalMaterial() it works. EDIT: @pguardiario answer worked for me |
I was able to render a webgl frame as a pdf using the following arguments.
|
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
As far as I know this is still an issue. The screenshots workaround works well, but if that is the way to go I think it should be documented or, even better, integrated. 😊 If puppeteer was able to take screenshots automatically it would be great to be able to specify the format and quality (if applicable), since it has a big impact on the size of the generated PDF. |
After two months of trying a lot of solutions, this one worked finally. thanks for thinking out of the box. 🚀🚀 |
I am not able to reproduce the issue using the latest versions. Are there pages that still do not work? |
@OrKoN Can't you reproduce using this URL? https://app.ieco.io/examples/industrial/en For me, the 3D rendering at the front page (the one with the building) appears blank when creating the PDF. |
Summary:
I am trying to get a PDF of a page that has a panoramic image on it using Puppeteer. The panoramic image is rendered using WebGL, which I suspect to be the issue. All I get is a black box instead of the image (see the bottom of this post for screen image). But, I can use Puppeteer to get a screenshot of that same page and the panorama looks great. I am not sure why it won't render when I attempt getting a PDF, but works for screenshot.
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
--use-gl=swiftshader
--use-gl=osmesa
--use-gl=swiftshader-webgl
What is the expected result?
I would expect the PDF to look like the screenshot -- like this
Here is the screenshot from Puppeteer (NOTE: the html page is formatted slightly differently for PDF rendering, but the panoramic image is the same)
What happens instead?
The PDF has a black box where the panoramic image should be.
The text was updated successfully, but these errors were encountered: