Skip to content
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

Cannot render images generated by plotly #71

Open
bondeanikets opened this issue Sep 29, 2017 · 4 comments
Open

Cannot render images generated by plotly #71

bondeanikets opened this issue Sep 29, 2017 · 4 comments

Comments

@bondeanikets
Copy link

My div (which corresponds the id 'Usage') consists of plotly-generated images along with some text. The text before the image is present in the pdf generated, but the images and the later text is absent. Tried {embedLocalImages: 'true'} as well, but in vain. Please suggest a solution.

Thanks

@kbrown01
Copy link
Contributor

kbrown01 commented Oct 2, 2017

Can you create a fiddle please? It is hard to speculate without seeing the sample

@kbrown01
Copy link
Contributor

kbrown01 commented Oct 2, 2017

I did create a simple ploty plot and while things do print, I do see issues that may have to do with svg's inside svg's (plotly uses this extensively).

See https://jsfiddle.net/c1kt3r82/220/

@bondeanikets
Copy link
Author

Thanks for the fiddle. So, is there any solution that you can suggest?

@kbrown01
Copy link
Contributor

kbrown01 commented Oct 2, 2017

Yes. I extracted the SVG from the page and that formats. Good news. So I tracked backwards to see what is happening and I know what is wrong, how to fix it will take some thought.

The software works by creating a hidden div in the page and then scrapes the HTML DOM and puts it into that div and grabs the results and sends to the formatter. It has to operate this way because all CSS needs to be resolved.

When that happens, something in the plotly SVG that is embedded in the other SVG returns a width/height of 0. Here is a side by side comparsion:

image

What you would have to do is to remove them or replace them with the correct width. I stopped the process and fix the width/height and it works:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants