Append text attribute into Svg file

Discuss SVG code, accessible via the XML Editor.
TalwinderS
Posts: 7
Joined: Fri Nov 16, 2012 10:38 pm

Append text attribute into Svg file

Postby TalwinderS » Tue Nov 20, 2012 9:21 pm

Hello

I have converted the mens_invitation_AI.ai file into .svg format, but I want to update the content of the .svg file.
I have also attached the .svg file, you can review it, in which I wanna update the "Jason’s 30th Birthday Party" content
on the attached .svg file, so please let me know how I can append the text attribute into .svg file.

Have a nice day.
Attachments
mens_invitation_manual.svg
(65.93 KiB) Downloaded 355 times

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Append text attribute into Svg file

Postby chriswww » Wed Nov 21, 2012 10:17 am

What is exactly the issue? Are you already using a xslt stylesheet and having trouble coding the change to that particular text span node? Or do you want general advice? If it's a one-of, can't you just open it in a text editor and change the text and save it?

TalwinderS
Posts: 7
Joined: Fri Nov 16, 2012 10:38 pm

Re: Append text attribute into Svg file

Postby TalwinderS » Wed Nov 21, 2012 3:05 pm

The Issue is, I'm converting the file to SVG format using Commandline in Asp.net, now as per the standard SVG provided by my end User the Text attributes are all outside the <g> tag, i.e, they are at the end of the file just above the closing of root svg("</svg>") but the one that is generated using inkscape conversion via commandline in my asp.net code is having the text attributes in the middle of file, so to make things work, I am trying to read XML and get all the Text attributes at the same place as is like the end user's file.I've attached the file generated by conversion.

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Append text attribute into Svg file

Postby chriswww » Thu Nov 22, 2012 9:44 am

I must be a bit thick as I still don't fully get the picture. Once you're working with xml or svg the order of tags doesn't matter as long as they're in the correct place in the hierarchy of nodes. Therefore using a less procedural code, there must be xslt transforms available in asp.net, you shouldn't have to worry about the exact order of nodes or tags. If i'm not understanding your question correctly, can you upload the two other files you mention, for a visual comparison to make it clear as to what's going on. I can open your invitation no problem in inkscape, btw hope you changed the phone number in the file. The title on the invitation has weird kerning but that's all that i see wrong with it.

TalwinderS
Posts: 7
Joined: Fri Nov 16, 2012 10:38 pm

Re: Append text attribute into Svg file

Postby TalwinderS » Thu Nov 22, 2012 4:32 pm

Hello Chris, I've attached the original file, like I want converted files to be.
Attachments
superhero_invite.svg
original
(163.38 KiB) Downloaded 329 times

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Append text attribute into Svg file

Postby chriswww » Mon Nov 26, 2012 6:43 am

So you want to grab a couple of text strings from earlier card design and transplant into new card? How many cards is involved? Have you had a go using dom or xslt?

TalwinderS
Posts: 7
Joined: Fri Nov 16, 2012 10:38 pm

Re: Append text attribute into Svg file

Postby TalwinderS » Wed Nov 28, 2012 4:13 pm

I've done everything by rewriting SVG, I'm just left with a last issue, i.e, setting positions of characters in a word, my client is using different fonts for different ai files, and svg files are dependent on positions to display words correctly, I can calculate positions but in case of different fonts it's a bit dodgy, can you help on that ?

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Append text attribute into Svg file

Postby chriswww » Mon Dec 10, 2012 9:29 am

Why not set the anchor point to horizontal center point of the object. Hopefully the font is not too big or the text will spill outside. Otherwise you have a whole lot of calculations to do.


Return to “SVG / XML Code”