 #!/bin/bash

          	echo "Hello"
		FILE=`zenity --file-selection --title="Select a Pdf File"`
                #echo "\"$FILE\" selected."
			basename $FILE .pdf  # to get file name without path and without ext
			base=${FILE%%.*} ## to get only file name , this will be used to create/move other file type html/jpg/png with same name and path
			#echo $base
			ext=${FILE#*.}  ## To get file extension only
			#echo $ext 
			extension='pdf'
			#echo $extension
			if [ $ext = $extension ]
			then
				temp_folder=~/Desktop/pdf_temp/
				mkdir $temp_folder
				pdftohtml -s $FILE 
				mv $base*.html $base*.png $base*.jpg  $temp_folder
				#echo $FILE 
				#echo $temp_folder`basename $FILE .pdf`-html.html 
				firefox -new-window $temp_folder`basename $FILE .pdf`-html.html 
        	        else
				echo 'Not a pdf file'
			fi
		

	  

#######resources#################
### for nautilus file manager#########http://linuxandfriends.com/2008/10/31/run-nautilus-file-manager-sans-gnome-desktop/############
##########http://www.linuxjournal.com/article/2460#########
##########http://www.softpanorama.org/Scripting/Shellorama/Reference/string_operations_in_shell.shtml##################
############http://www.freeos.com/guides/lsst/ch03sec02.html#################
