-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Styler.to_pdf() and Styler.to_svg() #52455
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
Comments
Slightly related (also talks about |
I don't know SVG or PDF generation well but its strikes me that there are one or two things that are different here. HTML, LateX and Excel have their own structured language for creating styles, be it some kind of attribute value pair. That allows a template language in python to easily generate tables. Some are easier than others. Latex has a bit of rewiring and excel a smaller bit of remapping, but they get the job done in a general and flexible way. From what I read about SVG it seems to have a very general language meaning everything styled in a table here would have to be subjectively structured by the pandas developer - there seems to multiple ways of creating a basic table, for example, not to mention how one deals with styles such as font size, colors, borders, etc, which would probably have to manually coded? |
I don't follow. I.t.o. syntax and feature support, HTML and SVG are about as close as can be. In fact, you can embed HTML tables directly into an SVG using the Here's an example of what that would look like <svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
<!-- Common use case: embed HTML text into SVG -->
<foreignObject x="0" y="0" width="500" height="500">
<!--
In the context of SVG embedded in an HTML document, the XHTML
namespace could be omitted, but it is mandatory in the
context of an SVG document
-->
<div xmlns="http://www.w3.org/1999/xhtml">
<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td>Magazzini Alimentari Riuniti</td>
<td>Giovanni Rovelli</td>
<td>Italy</td>
</tr>
</table>
</div>
</foreignObject>
</svg> |
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
Styler
already supports exporting to HTML. Wouldn't be a long shot from there to support exporting as SVG too which is accepted by many more programs like graphics editors and presentation software like PowerPoint and Keynote. The same is true for PDF. You can't drag and drop HTML into Keynote but you can PDFs.Feature Description
Alternative Solutions
Most of the
to_html
kwargs readily apply to SVG so.svg
export support could be incorporated into that method but should then be highlighted in the docs.Additional Context
No response
The text was updated successfully, but these errors were encountered: