Closed AliRezaBeigy closed 2 years ago
Thank you very much.
Could you please rename stripNs
to something more meaningful. I guess it removes namespaces? So something like stripNamespaces
.
Also could you please explain what your PR improves? Does it only switch the dependency?
Could you please rename
stripNs
to something more meaningful. I guess it removes namespaces?
Yes you are right
Also could you please explain what your PR improves? Does it only switch the dependency?
as I said previous code can't generate HTML tag inside foreignObject tag Example:
<image id="image1" class="slide" in="0.0" out="3172.3" xlink:href="presentation/1fab9b215b3b3c010315fb5ae264fd98798573ae-1655896500429/slide-1.png" width="1600" height="900" x="0" y="0" style="visibility:hidden" text="presentation/1fab9b215b3b3c010315fb5ae264fd98798573ae-1655896500429/textfiles/slide-1.txt"/>
<g class="canvas" id="canvas1" image="image1" display="none">
<g id="image1-draw1" class="shape" timestamp="202.9" undo="-1" shape="image1-poll1" style="visibility:hidden">
<image width="544.0" height="119.88" x="1056.0" y="780.12" xlink:href="presentation/1fab9b215b3b3c010315fb5ae264fd98798573ae-1655896500429/poll_result1.svg"/>
</g>
<g id="image1-draw2" class="shape" timestamp="242.2" undo="-1" shape="image1-text2" style="color:#000000;word-wrap:break-word;visibility:hidden;font-family:Arial;font-size:58.32793px">
<switch>
<foreignObject width="1259.91283" height="659.12106" x="79.61038" y="64.1608">
<p xmlns="http://www.w3.org/1999/xhtml" style="margin:0;padding:0">Present perfect <br/><br/>Simple past </p>
</foreignObject>
</switch>
</g>
...
Ok, thank you very much :) Looks like a good improvement. I will test it later, when I come home, merge it and release it :)
Actually may I asky you for a test URL? You can also send it to me via email (in my profile) if you do not want that it is added to my test URLs in the launch.json
Because I guess my old URLs do not have html Elements.
I merge it nevertheless, because It seems to function as before.
Because we have a new issue https://github.com/C0D3D3V/bbb-dl/issues/24 that also is about annotations, I had finally time to test it :D The thing is, this is a lot slower than the old solution with cairosvg (PNGSurface). At least for the session I got from the issue, it needs to create hundreds of screenshots and every time needs to open a headless chromium instance.
I think I will add an check if the svg contains an fragment and decide that way to use cairosvg (PNGSurface) or html2image. Would you be fine with that? Could you send me an bbb session that uses foreignObject so that I can test if it still works after my changes?
I did a few measurement (100) with the session I got from the other issue. Results are in seconds.
measurements_Html2Image: ['1.506', '0.907', '1.030', '1.108', '0.901', '0.893', '1.033', '1.353', '1.029', '1.001', '1.006', '1.267', '1.104', '1.108', '0.912', '0.897', '0.970', '0.908', '1.208', '1.080', '0.923', '1.062', '1.167', '0.968', '1.855', '1.185', '1.209', '1.389', '1.617', '1.309', '1.248', '0.923', '1.128', '1.185', '1.335', '1.024', '1.233', '1.110', '1.168', '1.157', '1.187', '1.226', '1.132', '1.041', '0.917', '1.164', '1.269', '1.108', '1.410', '1.301', '1.355', '1.419', '1.461', '1.309', '1.512', '1.180', '1.071', '1.142', '1.482', '1.571', '1.458', '1.052', '1.605', '1.144', '1.141', '1.158', '1.061', '1.613', '1.351', '1.098', '1.365', '1.785', '1.502', '1.155', '1.088', '0.972', '1.198', '1.045', '0.967', '1.065', '0.928', '1.616', '1.478', '1.224', '1.103', '1.223', '1.064', '1.130', '1.107', '0.911', '1.000', '0.918', '1.180', '1.088', '1.146', '0.968', '1.085', '1.513', '1.043', '1.191', '1.084']
measurements_PNGSurface ['0.216', '0.181', '0.187', '0.191', '0.188', '0.188', '0.192', '0.206', '0.202', '0.204', '0.202', '0.209', '0.201', '0.214', '0.210', '0.221', '0.216', '0.223', '0.263', '0.227', '0.240', '0.228', '0.233', '0.247', '0.297', '0.276', '0.259', '0.846', '0.289', '0.248', '0.305', '0.253', '0.264', '0.361', '0.291', '0.275', '0.282', '0.352', '0.282', '0.322', '0.356', '0.339', '0.352', '0.342', '0.318', '0.460', '0.396', '0.428', '0.461', '0.482', '0.424', '0.407', '0.553', '0.324', '0.425', '0.350', '0.465', '0.466', '0.510', '0.478', '0.336', '0.410', '0.561', '0.434', '0.417', '0.448', '0.440', '0.728', '0.575', '0.468', '0.479', '0.472', '0.428', '0.383', '0.390', '0.391', '0.392', '0.406', '0.394', '0.436', '0.692', '0.473', '0.431', '0.463', '0.437', '0.436', '0.458', '0.436', '0.431', '0.442', '0.440', '0.437', '0.446', '0.490', '0.453', '0.446', '0.503', '0.509', '0.591', '0.533', '0.555']
measurements_Html2Image mean: 1.1830991884653466
measurements_PNGSurface mean 0.3735021615148515
Html2Image is 3 times as slow as PNGSurface. Also Html2Image makes the screenshots slightly offset and has slightly bigger filesize :D I think it is worth to add the condition. I will also try to fix that it spams the terminal with chromium warnings.
Hi I use html2image instead of cairosvg that doesn't support foreignObject, which contains HTML tags