0

I have around 200 xaml files that was generated from Illustrator so the text inside them is in this format:

>     <Canvas Name="TextBlock" Height="338.674" Canvas.Left="0" Canvas.Top="0" Width="378.608">
>                       <Path Data="F1M66.54195,312.7368L66.54195,311.1118L57.807575,311.1118L57.807575,295.64305L55.97945,295.64305L55.97945,312.7368L66.54195,312.7368"
> Fill="Black" Height="17.094" Canvas.Left="1.75" Stretch="Fill"
> Canvas.Top="85.899" Width="10.562"/>
>                       <Path Data="F1M78.4502,306.83055C78.4502,305.002425,78.2002,303.346175,77.0127,302.127425C76.184575,301.314925,75.059575,300.783675,73.622075,300.783675C72.184575,300.783675,71.059575,301.314925,70.23145,302.127425C69.04395,303.346175,68.79395,305.002425,68.79395,306.83055C68.79395,308.658675,69.04395,310.314925,70.23145,311.533675C71.059575,312.346175,72.184575,312.877425,73.622075,312.877425C75.059575,312.877425,76.184575,312.346175,77.0127,311.533675C78.2002,310.314925,78.4502,308.658675,78.4502,306.83055
> M76.715825,306.83055C76.715825,308.158675,76.653325,309.6118,75.778325,310.4868C75.23145,311.033675,74.465825,311.346175,73.622075,311.346175C72.778325,311.346175,72.04395,311.033675,71.48145,310.4868C70.622075,309.6118,70.528325,308.158675,70.528325,306.83055C70.528325,305.51805,70.622075,304.0493,71.48145,303.189925C72.04395,302.627425,72.778325,302.314925,73.622075,302.314925C74.465825,302.314925,75.23145,302.627425,75.778325,303.189925C76.653325,304.0493,76.715825,305.51805,76.715825,306.83055" Fill="Black" Height="12.094" Canvas.Left="14.565" Stretch="Fill"
> Canvas.Top="91.04" Width="9.656"/>
>                       <Path Data="F1M91.310825,312.7368L91.310825,300.9243L89.57645,300.9243L89.57645,308.20555C89.57645,310.26805,88.404575,311.346175,86.623325,311.346175C84.8577,311.346175,83.748325,310.283675,83.748325,308.20555L83.748325,300.9243L82.029575,300.9243L82.029575,308.471175C82.029575,309.83055,82.38895,310.95555,83.217075,311.783675C83.935825,312.502425,84.998325,312.877425,86.26395,312.877425C87.592075,312.877425,88.76395,312.377425,89.6077,311.4243L89.6077,312.7368L91.310825,312.7368"
> Fill="Black" Height="11.953" Canvas.Left="27.8" Stretch="Fill"
> Canvas.Top="91.18" Width="9.281"/>

My question is: can i generate these letters as text using c# code?

Alex
  • 5,971
  • 11
  • 42
  • 80
  • 2 ways come to mind like put them in a XPS document shell or a WPF window? – kenny May 28 '12 at 11:13
  • Could you explain a bit more? I interpreted the question quite differently than @jageen did. So we need to know what it is you want. – Emond May 28 '12 at 11:54
  • i need to do a small windows app let's say, that read this xaml file and save the text inside it to text file, the text is now in the format above – Alex May 28 '12 at 12:11

2 Answers2

1

Please see this answer to Processing Illustrator or pdf files into XAML: https://stackoverflow.com/a/4536756/563088

In short: the exporter has to support it. It i snearly impossible to turn paths back in to glyphs/text. That is OCR.

Community
  • 1
  • 1
Emond
  • 50,210
  • 11
  • 84
  • 115
0

Yes you can do you can use xml deserialization,

what you need for it is 1 >A Xsd file for validation ( if you want ) 2 > A class file which can store data of you xml file

you can use Xsd.exe for create class from Xsd file. and for create Xsd file for xml. Open Xml file in C# IDE and go to Schema menu > create Xsd file.

for help here is links How to Deserialize XML document ( example of deserialization ) http://msdn.microsoft.com/en-us/library/x6c1kb0s%28v=vs.71%29.aspx ( help for Xsd.exe )

Community
  • 1
  • 1
Jageen
  • 6,345
  • 2
  • 37
  • 56
  • if you get any problem in creating Xsd file or class file let me knw :) Best of luck. – Jageen May 28 '12 at 11:17
  • How is this going to turn paths into text? – Emond May 28 '12 at 11:17
  • You mean you want – Jageen May 28 '12 at 11:49
  • I thought the question was about turning the paths into text but I might be wrong... – Emond May 28 '12 at 11:53
  • yes i need this: Fill="Black" Height="17.094" Canvas.Left="1.75" Stretch="Fill" > Canvas.Top="85.899" Width="10.562"/> to be "S" for example – Alex May 28 '12 at 12:12
  • I am right now busy with my project otherwise i will surely send you code but for now hee is a link http://www.kirupa.com/net/reading_xml_directly_pg1.htm it show an example how you can read property value of tag in xml – Jageen May 28 '12 at 13:10
  • @jageen - are you sure you are going to be able to translate the path in to a literal "S"? – Emond May 28 '12 at 15:37
  • What i understand from you question is.. You want that path Data value in string is it k ? It will helps u to get F1M66.54195,312.7368L66.54195,311.1118L57.807575,311.1118L57.807575,295.64305L55.97945,295.64305L55.97945,312.7368L66.54195,312.7368 from Path tag. – Jageen May 29 '12 at 03:32