Jump to content

Recommended Posts

Posted

Hello, i am having trouble opening SVG files on Affinity Designer and Photo, some item misteriously move. Here is a link for a flag download SVG that works as an example. It should open as the picture shows, but the details within the objects move and appear outside the canvas.

 

https://es.wikipedia.org/wiki/Bandera_de_la_Comunidad_Valenciana#/media/Archivo:Adaptació_corona_senyera.svg

Posted

Hi,

that's a difficult to correctly parse and handle SVG one, since it looks like initially been created with Inkscape and then in turn has been modified or reworked with Adobe Illustrator ...

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
	<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
	<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
	<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
	<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
	<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
]>
<svg version="1.0"
	 id="svg9885" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" sodipodi:version="0.32" xmlns:svg="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" inkscape:version="0.43" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" sodipodi:docbase="C:\Documents and Settings\empresa\Escritorio" sodipodi:docname="Flag_of_the_Land_of_Valencia_(official).svg"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1170px"
	 height="305.448px" viewBox="-127.5 1012.052 1170 305.448" enable-background="new -127.5 1012.052 1170 305.448"
	 xml:space="preserve">
<switch>
	<foreignObject requiredExtensions="&ns_ai;" x="0" y="0" width="1" height="1">
		<i:pgfRef  xlink:href="#adobe_illustrator_pgf">
		</i:pgfRef>
	</foreignObject>
	<g i:extraneous="self">
		<g id="g6092">
			<g id="g4810" transform="matrix(0.8966953,0,0,0.8966953,43.501445,59.479367)">
				<path id="path4629" fill="#EAC102" stroke="#000000" stroke-width="1.1152" d="M36.216,1162.938
					c-10.451-15.268-64.181-27.552-32.12-48.132c-1.644,18.25,16.861,0.53,12.731-7.973c-4.06-7.352-30.894,3.522-30.973,25.573
					c-0.166,13.905,35.093,24.662,51.805,37.841L36.216,1162.938z"/>
				<path id="path4631" fill="#EAC102" stroke="#000000" stroke-width="1.1152" d="M141.185,1162.938
					c10.451-15.268,64.17-27.552,32.121-48.132c1.632,18.25-16.862,0.53-12.732-7.973c4.058-7.352,30.893,3.522,30.957,25.573
					c0.181,13.905-35.078,24.662-51.8,37.841L141.185,1162.938z"/>
			</g>
			<g id="g4949" transform="translate(4.765625,4.3027769)">
				<path id="path4688" fill="#EAC102" stroke="#000000" d="M261.868,1125.047c-5.403,0.461-3.356,2.942-9.049,3.244
					c-5.015,0.24-12.731-8.078-18.48-7.521c-10.348,8.172,11.82,23.35,16.573,25.314
					C254.18,1147.429,268.008,1128.443,261.868,1125.047z"/>
				<path id="path4690" fill="#EAC102" stroke="#000000" d="M254.677,1106.539c-0.384-11.92-6.748-22.918-7.362-29.938
					c-0.619-7.029,2.577-12.441,8.655-21.575c4.03,10.219,4.727,18.767,3.917,26.53
					C259.071,1089.338,256.726,1099.381,254.677,1106.539z"/>
				<path id="path4692" fill="none" stroke="#000000" stroke-width="0.5" d="M254.892,1105.462
					c2.207-16.382,4.941-29.258,1.078-50.212"/>
				<path id="path4694" fill="#EAC102" stroke="#000000" d="M235.014,1125.547c0.104-7.188,20.765-14.791,17.194-33.897

...
...

... further it's older SVG v1.0 code and those Adobe style settings are probably not recognized completely at all by the Affinity SVG parser. The whole thus will be offset and would need a bunch of adjustments to showup correctly inside the AD document bounds.

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

  • 6 months later...
Posted

I also have been having an issue opening SVG files. Files generated out of Blender using the Plugin Freestyle SVG Export will not open in Designer. This happens on Mac and Windows. I have played around with it and used a text editor to replace this line at the top of the page "<?xml version='1.0' encoding='ascii'?>" with this line "<?xml version="1.0" encoding="UTF-8" standalone="no"?>". After replacing the line I can open the SVG in Designer. I have tried doing a minor edit in the text editor and saving but that did not help. If I open the SVG in Inkscape ad save it again it works just fine. Attached some files and a dialog box shot.

Designer Dialog.PNG

This file wont open.svg This file will open.svg

  • 2 years later...
Posted
On 5/21/2021 at 6:07 AM, laraksca said:

I also have been having an issue opening SVG files. Files generated out of Blender using the Plugin Freestyle SVG Export will not open in Designer. This happens on Mac and Windows. I have played around with it and used a text editor to replace this line at the top of the page "<?xml version='1.0' encoding='ascii'?>" with this line "<?xml version="1.0" encoding="UTF-8" standalone="no"?>". After replacing the line I can open the SVG in Designer. I have tried doing a minor edit in the text editor and saving but that did not help. If I open the SVG in Inkscape ad save it again it works just fine. Attached some files and a dialog box shot.

Yes, the problem is that Affinity can't read a SVG files when it is encoded in ascii. If you are still using the Freestyle Plugin in Blender, then you could just replace the relevant variables in the source code of the plugin to utf-8. On Mac, the python file is located in Blender.app/Contents/Resources/3.6/scripts/addons/render_freestyle_svg.py

# use utf-8 here to keep ElementTree happy, end result is utf-16
# NOTE algo fixed encoding issue where affinity designer rejects ascii
svg_primitive = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>

...

# also change the encoding of all three tree.write functions to UTF-8
tree.write(filepath, encoding='UTF-8', xml_declaration=True)

Or if you also want to simplify lines by removing redundant points, then you could install Inkscape and use its command line interface in shell (bash command):

inkscape --actions="select:strokes; path-simplify; export-filename:0001.svg; export-do; " 0001.svg

Inkscape will open the svg, simplify the path and then overwrite the svg file with utf-8 encoding.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.