decode_pdf.decodePage( page );
//get the PdfImages object which now holds the images.
//binary data is stored in a temp directory and we hold the
//image name and other info in this object
PdfImageData pdf_images = decode_pdf.getPdfImageData();
//image count (note image 1 is item 0, so any loop runs 0 to count-1)
int image_count = pdf_images.getImageCount();
String target=output_dir+separator;
if(downsampled)
target=target+"downsampled"+separator+page+separator;
else
target=target+"normal"+separator+page+separator;
//tell user
if( image_count > 0 ){
//create a directory for page
File page_path = new File( target );
if( page_path.exists() == false )
page_path.mkdirs();
//do it again as some OS struggle with creating nested dirs
page_path = new File( target );
if( page_path.exists() == false )
page_path.mkdirs();
}
//work through and save each image
for( int i = 0;i < image_count;i++ )
{
String image_name = pdf_images.getImageName( i );
BufferedImage image_to_save;
try
{
if(downsampled){