Re: How to interpret/retrieve coordinates from svg file?
Robert Longson <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.svg |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <c090f7f9-1d8b-4917-bcb2-8a69e7c5ef6a@x16g2000prn.googlegroups.com> |
On Dec 11, 8:24 am, gans92 <[email protected]> wrote: > Hi, > > I am not sure if I am posting this question on the right forum. Would > appreciate of you direct me to the right forum. The right forum is http://tech.groups.yahoo.com/group/svg-developers/messages?o=1 since these are not firefox specific questions. Here is my problem: > > I have a pdf document which I have converted to svg format. > I wish to retireve the text along with the bounding rectangular coordinates > of each word in the document. > My svg file has x,y, coordinate informataion as a transformation matrix. > Here is an entry: > > <text transform="matrix(1 0 0 -1 66 649.44)"><tspan > x="0,6.145,8.2317,10.318,12. > 405,15.002,20.637" y="0" class="ps01 ps10 ps25">Sample text</tspan></text> > > I am not able to understand how to get the 4 rectangular (x,y) coordinates > from this. > > Following are my queries: > > a) Is it possible to extract bounding rectangular coordinates from svg > files? You can use getBBox (http://wiki.svg.org/GetBBox) > b) Are there any api to retrieve this information, given a text to search? The same DOM apis that work for html work for SVG too to get text. http://www.w3schools.com/dom/prop_element_textcontent.asp for instance. Best regards Robert.