if ( baseURL.lastIndexOf( IBirtConstants.SERVLET_PATH_RUN ) > 0 )
if ( baseURL.lastIndexOf( IBirtConstants.SERVLET_PATH_RUN ) > 0 || IBirtConstants.PDF_RENDER_FORMAT .equalsIgnoreCase( format ) )
	protected String buildDrillAction( IAction action, IReportContext context )	{		if ( action == null || context == null )			return null;		String baseURL = null;		Object renderContext = getRenderContext( context );		if ( renderContext instanceof HTMLRenderContext )		{			baseURL = ( (HTMLRenderContext) renderContext ).getBaseURL( );		}		if ( renderContext instanceof PDFRenderContext )		{			baseURL = ( (PDFRenderContext) renderContext ).getBaseURL( );		}		if ( baseURL == null )			baseURL = IBirtConstants.VIEWER_RUN;		StringBuffer link = new StringBuffer( );		String reportName = getReportName( context, action );		if ( reportName != null && !reportName.equals( "" ) ) //$NON-NLS-1$		{			link.append( baseURL );			link					.append( reportName.toLowerCase( )							.endsWith( ".rptdocument" ) ? "?__document=" : "?__report=" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$			try			{				link.append( URLEncoder.encode( reportName,						ParameterAccessor.UTF_8_ENCODE ) );			}			catch ( UnsupportedEncodingException e1 )			{				// It should not happen. Does nothing			}			// add format support			String format = action.getFormat( );			if ( format != null && format.length( ) > 0 )			{				link.append( ParameterAccessor.getQueryParameterString(						ParameterAccessor.PARAM_FORMAT, format ) );			}			// Adds the parameters			if ( action.getParameterBindings( ) != null )			{				Iterator paramsIte = action.getParameterBindings( ).entrySet( )						.iterator( );				while ( paramsIte.hasNext( ) )				{					Map.Entry entry = (Map.Entry) paramsIte.next( );					try					{						String key = (String) entry.getKey( );						Object valueObj = entry.getValue( );						if ( valueObj != null )						{							// TODO: here need the get the format from the							// parameter.							String value = DataUtil.getDisplayValue( valueObj );							link									.append( ParameterAccessor											.getQueryParameterString(													URLEncoder															.encode(																	key,																	ParameterAccessor.UTF_8_ENCODE ),													URLEncoder															.encode(																	value,																	ParameterAccessor.UTF_8_ENCODE ) ) );						}					}					catch ( UnsupportedEncodingException e )					{						// Does nothing					}				}				// Adding overwrite.				if ( !reportName.toLowerCase( ).endsWith(						ParameterAccessor.SUFFIX_REPORT_DOCUMENT )						&& baseURL								.lastIndexOf( IBirtConstants.SERVLET_PATH_FRAMESET ) > 0 )				{					link.append( ParameterAccessor.getQueryParameterString(							ParameterAccessor.PARAM_OVERWRITE, String									.valueOf( true ) ) );				}			}			if ( locale != null )			{				link.append( ParameterAccessor.getQueryParameterString(						ParameterAccessor.PARAM_LOCALE, locale.toString( ) ) );			}			if ( isRtl )			{				link.append( ParameterAccessor.getQueryParameterString(						ParameterAccessor.PARAM_RTL, String.valueOf( isRtl ) ) );			}			// add isMasterPageContent			link.append( ParameterAccessor.getQueryParameterString(					ParameterAccessor.PARAM_MASTERPAGE, String							.valueOf( this.isMasterPageContent ) ) );			// add bookmark			if ( action.getBookmark( ) != null )			{				try				{					// In RUN mode, don't support bookmark as parameter					if ( baseURL.lastIndexOf( IBirtConstants.SERVLET_PATH_RUN ) > 0 )					{						link.append( "#" ); //$NON-NLS-1$					}					else					{						link.append( "&__bookmark=" ); //$NON-NLS-1$					}					link.append( URLEncoder.encode( action.getBookmark( ),							ParameterAccessor.UTF_8_ENCODE ) );				}				catch ( UnsupportedEncodingException e )				{					// Does nothing				}			}		}		return link.toString( );	}