import java.io.FileOutputStream;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.Locale;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfAction;
import com.lowagie.text.pdf.PdfOutline;
import com.lowagie.text.pdf.PdfWriter;

public class Sample
{

	public static void main( String[] args )
	{
		Document document = new Document( );
		Document.compress = false;
		try
		{
			PdfWriter writer = PdfWriter.getInstance( document,
					new FileOutputStream( "D:/PdfString.pdf" ) );
			document.open( );
			document
					.add( new Chunk(
							"Please Note: The table of content is not displayed properly!" ) );
			NumberFormat fmt = NumberFormat.getNumberInstance( Locale.FRANCE );
			String title = fmt.format( 123456.79 );
			writer.setViewerPreferences( PdfWriter.PageModeUseOutlines );
			new PdfOutline(
					writer.getDirectContent( ).getRootOutline( ),
					PdfAction
							.javaScript(
									"app.alert('The French 1000's separator is replaced with Euro sign.');\r",
									writer ), title );

		}
		catch ( DocumentException de )
		{
			System.err.println( de.getMessage( ) );
		}
		catch ( IOException ioe )
		{
			System.err.println( ioe.getMessage( ) );
		}
		document.close( );
	}
}