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

Convert odp to jpeg in JAVA

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
manya
General User
General User


Joined: 04 Dec 2006
Posts: 21

PostPosted: Fri Mar 30, 2007 11:35 am    Post subject: Convert odp to jpeg in JAVA Reply with quote

Please help!!!!!
I need to convert presentation to pictures(jpeg) in Java.
Back to top
View user's profile Send private message
JZA
OOo Advocate
OOo Advocate


Joined: 01 Feb 2003
Posts: 432
Location: Mexico

PostPosted: Fri Mar 30, 2007 5:50 pm    Post subject: Reply with quote

I remember there is an ExportToPDF function in Basic, I wonder if you can search for an Export to Jpeg.

After looking around with the Andrew Pitonyak Macro Document.
I found the following snippet:
Code:
Sub ExportCurrentPageOrSelection
  REM Filter dependent filter properties
  Dim aFilterData (4) As New com.sun.star.beans.PropertyValue
  Dim sFileUrl As String

  aFilterData(0).Name  = "PixelWidth"
  aFilterData(0).Value = 1000
  aFilterData(1).Name  = "PixelHeight"
  aFilterData(1).Value = 1000
  aFilterData(2).Name  ="LogicalWidth"
  aFilterData(2).Value = 1000
  aFilterData(3).Name  ="LogicalHeight"
  aFilterData(3).Value = 1000
  aFilterData(4).Name  ="Quality"
  aFilterData(4).Value = 60

  sFileUrl = "file:///d:/test2.jpg"

  REM A smart person would force this to be a Draw or Impress document
  xDoc = ThisComponent
  xView = xDoc.currentController
  xSelection = xView.selection
  If isEmpty( xSelection ) Then
    xObj = xView.currentPage
  Else
    xObj = xSelection
  End If
  Export( xObj, sFileUrl, aFilterData() ) 
End Sub

Sub Export( xObject, sFileUrl As String, aFilterData )
  Dim  xExporter

  xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
  xExporter.SetSourceDocument( xObject )

  Dim aArgs (2) As New com.sun.star.beans.PropertyValue
  Dim aURL As New com.sun.star.util.URL

  aURL.complete = sFileUrl
  aArgs(0).Name  = "MediaType"
  aArgs(0).Value = "image/jpeg"
  aArgs(1).Name  = "URL"
  aArgs(1).Value = aURL
  aArgs(2).Name  = "FilterData"
  aArgs(2).Value = aFilterData
  xExporter.filter( aArgs() )
End Sub


The script is not exactly the one you were expecitng but is a big start.
_________________
Alexandro Colorado
PPMC Apache OpenOffice
http://es.openoffice.org
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API 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