OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Exporting ODP slides in JPG or PNG format

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Impress
View previous topic :: View next topic  
Author Message
caoticud
Newbie
Newbie


Joined: 21 Feb 2012
Posts: 2
Location: Kolkata, India

PostPosted: Wed Jun 20, 2012 4:08 am    Post subject: Exporting ODP slides in JPG or PNG format Reply with quote

Our aim is simple - to export all slides of a presentation file as JPG images.
Constraints are
    Platform - CentOS 5.8, 32 bit
    Office suite - LibreOffice 3.4.*
    Batch process, web environment, Java 1.5, tomcat 6.0.35
    Solution must be in Java

We tried in following ways
    Method 1 - Converted ODP in PDF and created images from PDF, this works fine - no issue.
    Method 2 - Tried to export slides as JPG with com.sun.star.drawing.GraphicExportFilter. - Works fine in standalone mode, fails in web container. Exception - com.sun.star.lang.DisposedException, detailed stack-trace later
    Method 3 - Tried to get the XController object and use storeToURL method to save the current slide as image. Again, works fine in standalone mode, fails in web container. Exception - com.sun.star.lang.DisposedException


Reason for this exception is stated as multi-threaded access of java-libreoffice bridge. But we have made sure there is only one process, one bridge and strictly single threaded execution of the job.

Exception :

com.sun.star.lang.DisposedException: java.io.IOException: com.sun.star.io.IOException: EOF reached - socket,host=127.0.0.1,port=9999,tcpNoDelay=1,localHost=localhost.localdomain,localPort=57499,peerHost=localhost.localdomain,peerPort=9999
at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:158)

Method 2
Code:


Object graphicExportFilter =  officeConnectorManager.getService("com.sun.star.drawing.GraphicExportFilter");
XExporter graphicExporter = OfficeUtil.getQueryInterface(XExporter.class, graphicExportFilter);
XFilter graphicFilter = OfficeUtil.getQueryInterface(XFilter.class, graphicExportFilter);

...........
get draw pages
...........

for (...) {
PropertyValue[] propertyValues = new PropertyValue[4];
propertyValues[0] = new PropertyValue();
propertyValues[1] = new PropertyValue();
propertyValues[2] = new PropertyValue();
propertyValues[3] = new PropertyValue();

propertyValues[0].Name = "MediaType";
propertyValues[0].Value = "image/jpeg";
propertyValues[1].Name = "FilterData";
propertyValues[1].Value = presentationFilterData; // appropriate filter data
propertyValues[2].Name = "URL";
propertyValues[2].Value = OfficeUtil.toUrl(outFile);
propertyValues[3].Name = "Hidden";
propertyValues[3].Value = true;
xDrawPageObject = allSlides.getByIndex(i);
currentSlide = OfficeUtil.getQueryInterface(XDrawPage.class, xDrawPageObject);         
graphicExporter.setSourceDocument(OfficeUtil.getQueryInterface(XComponent.class   , currentSlide));
currentThumbImage = ThumbHandlerUtil.getOutputFile(fileInfo.getOutDirPath(), (i + 1));
graphicFilter.filter(propertyValues);
}



Method 3

Code:


XStorable storableDoc = OfficeUtil.getQueryInterface(XStorable.class, componentPresentation);
XModel docModel = OfficeUtil.getQueryInterface(XModel.class, componentPresentation);
XController docController = docModel.getCurrentController();
XDrawView drawView = OfficeUtil.getQueryInterface(XDrawView.class, docController);

...........
get draw pages
...........

for (...) {
PropertyValue[] propertyValues = new PropertyValue[3];

propertyValues[0] = new PropertyValue();
propertyValues[1] = new PropertyValue();
propertyValues[2] = new PropertyValue();

propertyValues[0].Name = "FilterName";
propertyValues[0].Value = OfficeFilterRegistry.getFilter(fileType, "jpg");
propertyValues[1].Name = "Overwrite";
propertyValues[1].Value = true;
propertyValues[2].Name = "FilterData";
propertyValues[2].Value = getPresentationFilterData(width, height); // appropriate filter data
currentThumbImage = ThumbHandlerUtil.getOutputFile(fileInfo.getOutDirPath(), (i + 1));
xDrawPageObject = allSlides.getByIndex(i);
currentSlide = OfficeUtil.getQueryInterface(XDrawPage.class, xDrawPageObject);
drawView.setCurrentPage(currentSlide);
                storableDoc.storeToURL(OfficeUtil.toUrl(currentThumbImage),
                        propertyValues );
}



It will be great if you can help me solve this issue - this will affect greatly on our app performance, output quality and stability.
_________________
Regards
Udita
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Wed Jun 20, 2012 6:55 am    Post subject: Reply with quote

This topic beyond me.

http://www.oooforum.org/forum/viewtopic.phtml?t=8715

Any help?
_________________
OpenOffice 4.0.0 and LibreOffice 4.x.x on Fedora 20, Ubuntu 13.10, Windows 8.1 Preview (Triple Boot)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Impress All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group