pPropValues );
Object GraphicExportFilter =
xOfficeContext.getServiceManager().createInstanceWithContext(
"com.sun.star.drawing.GraphicExportFilter", xOfficeContext);
XExporter xExporter = (XExporter)
UnoRuntime.queryInterface( XExporter.class, GraphicExportFilter );
PropertyValue aProps[] = new PropertyValue[2];
aProps[0] = new PropertyValue();
aProps[0].Name = "MediaType";
aProps[0].Value = "image/gif";
/* some graphics e.g. the Windows Metafile does not have a Media Type,
for this case
aProps[0].Name = "FilterName"; // it is possible to set a FilterName
aProps[0].Value = "WMF";
*/
java.io.File destFile = new java.io.File(args[1]);
java.net.URL destUrl = destFile.toURL();
aProps[1] = new PropertyValue();
aProps[1].Name = "URL";
aProps[1].Value = destUrl.toString();//args[ 1 ];
int nPageIndex = Integer.parseInt( args[ 2 ] );
if ( nPageIndex < PageHelper.getDrawPageCount( xComponent ) &&
nPageIndex > 1 )
{
XDrawPage xPage = PageHelper.getDrawPageByIndex( xComponent,
nPageIndex );
XComponent xComp = (XComponent)
UnoRuntime.queryInterface( XComponent.class, xPage );
xExporter.setSourceDocument( xComp );
XFilter xFilter = (XFilter)
UnoRuntime.queryInterface( XFilter.class, xExporter );
xFilter.filter( aProps );
System.out.println( "*** graphics on page \"" + nPageIndex
+ "\" from file \"" + args[0]