task.render( pageNumber );
task.setPageNumber( pageNumber ); task.render( );
	protected int renderReport( )	{		try		{			// use the archive to open the report document			IReportDocument document = engine.openReportDocument( source );			// create the render task			IRenderTask task = engine.createRenderTask( document );			// set report render options			IRenderOption options;			if ( format.equalsIgnoreCase( "html" ) )			{				options = new HTMLRenderOption( );				if ( "ReportletNoCSS".equals( htmlType ) )					( (HTMLRenderOption) options ).setEmbeddable( true );			}			else			{				options = new RenderOptionBase();			}			// set the output format			options.setOutputFormat( format );			// setup the output encoding			options.getOutputSetting( ).put( HTMLRenderOption.URL_ENCODING,					encoding );			// set the render options			task.setRenderOption( options );			// setup the application context			if ( format.equalsIgnoreCase( "html" ) )			{				HTMLRenderContext renderContext = new HTMLRenderContext( );				renderContext.setImageDirectory( "image" ); //$NON-NLS-1$				HashMap appContext = new HashMap( );				appContext.put( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,						renderContext );				task.setAppContext( appContext );			}			// setup the locale			task.setLocale( getLocale( locale ) );			// setup the output file			if ( pageNumber <= 0 )			{				int extPos = targetFile.lastIndexOf( '.' );				assert extPos != -1;				String pathName = targetFile.substring( 0, extPos );				String extName = targetFile.substring( extPos );				for ( long i = 1; i <= document.getPageCount( ); i++ )				{					String fileName = pathName + '_' + ( i ) + extName;					options.setOutputFileName( fileName );					task.render( i );				}			}			else			{				options.setOutputFileName( targetFile );				task.render( pageNumber );			}			task.close( );			return 0;		}		catch ( org.eclipse.birt.report.engine.api.EngineException e )		{			logger.log( Level.SEVERE, e.getMessage( ), e );			return -1;		}	}