0

I want to export image by converting svg to png for the following purpose I am using CairoSvg

It is working fine when I am svg that exists in English.

For Example :

Working Fine In English

But when I am exporting any svg in which arabic charcater exists it is not appearing correctly.

For Example :

Wrong image in arabic

Actually the title is القيمة السوقية / المبيعات but it is not appearing correctly

This is my code

svgchart = chart_pygal.render()
             pngfile = cairosvg.svg2png(bytestring=svgchart)
             with open(image_name+'.png','wb') as f:
                f.write(pngfile)
            # return send_file(pngfile,mimetype='image/png')
             return send_file(io.BytesIO(pngfile),mimetype='image/png', download_name=image_name+'.png', as_attachment=True)
Faizan Naeem
  • 433
  • 4
  • 13
  • Unfortunately it looks like CairoSVG does not support Arabic (or other languages which are not written left-to-right): https://cairosvg.org/documentation/ *"Other languages, and particularly those based on right-to-left or top-to-bottom directions are not supported at all."* – slothrop May 29 '23 at 19:41
  • @slothrop is there any other way I can achieve the functionality – Faizan Naeem May 29 '23 at 19:43
  • I don't know this stuff very well, but the person here seemed to have success with Inkscape (CLI tool): https://superuser.com/questions/482047/convert-svg-that-has-an-arabic-text-to-png-or-any-raster – slothrop May 29 '23 at 19:45

0 Answers0