Page 1 of 1

Transformation problem in pptx to svg

PostPosted: Thu Jul 22, 2010 7:05 pm
by joyy
Hi.

I am trying to convert pptx file in svg format. But I can get only text and boxes of pptx file not whole content in svg file.
So my svg file looks formerly black & white.

Here is my code:

File pptx = new File("pptxfile_path");
try {
PresentationMLPackage source = PresentationMLPackage.load(pptx);
Iterator partIterator = source.getParts().getParts().entrySet().iterator();
while (partIterator.hasNext()) {

Map.Entry pairs = (Map.Entry) partIterator.next();

Part p = (Part) pairs.getValue();
if (p instanceof SlidePart) {
ResolvedLayout rl = ((SlidePart) p).getResolvedLayout();

System.out.println(XmlUtils.marshaltoString(rl.getShapeTree(), false, true, Context.jcPML,
"http://schemas.openxmlformats.org/presentationml/2006/main", "spTree", GroupShape.class));

SvgExporter.svg(source, rl);
}
}
} catch (Docx4JException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

and from SvgExporter.svg(source,rl) I get string svg(e.g. String svg = intermediate.toString("UTF-8");) to write svg file.

I don't know where I do mistake.
Please help me.

Re: Transformation problem in pptx to svg

PostPosted: Fri Jul 23, 2010 4:00 am
by jason
You probably aren't doing anything wrong; its just that so far, only text boxes and lines are implemented.

What other shapes / objects do you need? If it is just images, they could be added easily.

Re: Transformation problem in pptx to svg

PostPosted: Fri Jul 23, 2010 3:23 pm
by joyy
Hi,
Thanx for reply.

yes,
I want whole data images,shapes but I don't know how to add these in my svg files.
Can you please help me?

Re: Transformation problem in pptx to svg

PostPosted: Tue Jul 27, 2010 7:39 pm
by jason
joyy wrote:I want whole data images,shapes but I don't know how to add these in my svg files.


Images I understand, but "whole data .. shapes", I don't.

An easy next step would be to support images. All other shapes would be a significant amount of work.

Re: Transformation problem in pptx to svg

PostPosted: Tue Jul 27, 2010 8:26 pm
by joyy
OK. Thnx for reply,

Now How can I add Images in my svg file?

In SvgExporter.java
from SvgExporter.svg(presentationMLPackage, rl);

I can get only
String svg = intermediate.toString("UTF-8");

and it gives only text not images.

Re: Transformation problem in pptx to svg

PostPosted: Wed Jul 28, 2010 3:28 am
by jason
I'll add image support in the next day or so.

Re: Transformation problem in pptx to svg

PostPosted: Thu Jul 29, 2010 5:12 am
by jason
Image support added in http://dev.plutext.org/trac/docx4j/changeset/1179

To see SVG lines in your html output, don't forget to use .xhtml file extension.

cheers .. Jason

Re: Transformation problem in pptx to svg

PostPosted: Fri Jul 30, 2010 12:55 am
by joyy
Hi.

Thnx for reply.

Now the new code is working fine for images.

But I have a problem, if the pptx file contains more than 2 slides then last slides data are override.

and the other thing is output .xhtml file contains text with red boxex.

I don't know what's goings wrong.

I am attaching the test case.pptx file and resulted testcase.xhtml files with this post.

Thnx in advance.

Re: Transformation problem in pptx to svg

PostPosted: Sat Jul 31, 2010 9:25 pm
by jason
joyy wrote:Now the new code is working fine for images.


Great.

joyy wrote:But I have a problem, if the pptx file contains more than 2 slides then last slides data are override.


SvgExporter.svg processes a single slide.

I've uploaded http://dev.plutext.org/docx4j/docx4j-ni ... 100731.jar which alters the API to make this more obvious. See http://dev.plutext.org/trac/docx4j/changeset/1180

Note that the RenderAsSvgInHtml sample doesn't attempt to process the slides in order - it really should be altered to do that I guess.

joyy wrote:and the other thing is output .xhtml file contains text with red boxex.


The XSLT was putting those in, to make it easier to check the positioning of the box. With the above changeset, the box will only appear if log4j logging on SvgExporter is set to DEBUG level.

Hope this helps. .. Jason