Page 1 of 1

pptx to SVG or any image

PostPosted: Thu Apr 07, 2011 10:07 pm
by Evgen
hi guys.
Can you help me find method to conver pptx to svg usual format. Not in svg in html.

Re: pptx to SVG or any image

PostPosted: Thu Apr 07, 2011 10:40 pm
by jason
The reason it is done this way is/was:
textArea (SVG 1.2 Tiny) - doesn't work in Chrome 4.0.249.64 or FF 3.5.7
so its not a feasible solution as at January 2010 :-(
See http://www.w3.org/TR/SVGTiny12/examples/textArea01.svg
from http://www.w3.org/TR/SVGTiny12/text.html#TextInAnArea
Opera 9.5 apparently supports it though!

Inkscape uses flowPara, but browsers can't render this.

carto textFlow.js works nicely in FF, but not Chrome :-(


Do you know whether text support has markedly improved in SVG renderers since then?

Re: pptx to SVG or any image

PostPosted: Thu Apr 07, 2011 11:46 pm
by Evgen
nope. i can't give you a good answer.
but it would be cool have a choice.
is it difficult to implement?

Re: pptx to SVG or any image

PostPosted: Thu Apr 07, 2011 11:58 pm
by jason
Pretty straightforward to implement, but you would have to do it .. I don't have time right now.

Are you aware that only basic text and lines are currently supported; that is, the "well known" shapes such as stars, smiley faces etc etc aren't currently converted to SVG. Just wanting to set your expectations...

Re: pptx to SVG or any image

PostPosted: Fri Apr 08, 2011 12:03 am
by Evgen
Yep. I know it. Can you give me advice from where i have to begin?

Re: pptx to SVG or any image

PostPosted: Fri Apr 08, 2011 12:43 am
by jason
See docx4j/src/pptx4j/java/org/pptx4j/convert/out/svginhtml/pptx2svginhtml.xslt

Copy that and change the root template:

Code: Select all
<xsl:template match="/">
   <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:svg="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink">
      <head>



so it is producing svg not html, and change

Code: Select all
<xsl:template match="p:txBody">

:      
          <div style="position: absolute; width:{$cx}px; height:{$cy}px; left:{$x}px; top:{$y}px;">
             <xsl:apply-templates select="a:p"/>
         </div>             
:        

</xsl:template>


so it inserts svg for text, instead of that html.

You can create the svg in the xsl:template itself, or in an extension function. The template for p:cxnSp is an example of creating svg in an extension function.

Interested to hear how it works out, a year or so on :-)