Index: /main/trunk/greenstone2/perllib/plugins/PDFv2Plugin.pm
===================================================================
--- /main/trunk/greenstone2/perllib/plugins/PDFv2Plugin.pm	(revision 32282)
+++ /main/trunk/greenstone2/perllib/plugins/PDFv2Plugin.pm	(revision 32283)
@@ -109,10 +109,10 @@
        'deft' => "1",
        'type' => "string" }, # xpdftools' zoom takes fractions
-     { 'name' => "use_sections",
-       'desc' => "{PDFPlugin.use_sections}",
-       'type' => "flag" },
-     { 'name' => "description_tags",
-       'desc' => "{HTMLPlugin.description_tags}",
-       'type' => "flag" },
+#     { 'name' => "use_sections",
+#       'desc' => "{PDFPlugin.use_sections}",
+#       'type' => "flag" },
+#     { 'name' => "description_tags",
+#       'desc' => "{HTMLPlugin.description_tags}",
+#       'type' => "flag" },
       { 'name' => "use_realistic_book",
         'desc' => "{PDFPlugin.use_realistic_book}",
@@ -159,26 +159,7 @@
     $self->{'convert_options'} .= " -pdf_zoom $zoom";
 
-    # check convert_to
-    
-    # Not all available conversion output options are possible with xpdftools, as some are
-    # only handled by pdfbox. If a format is unavailable with xpdftools, default to pretty_html
-    if ($self->{'convert_to'} =~ /^html$/) {
-	&gsprintf::gsprintf(STDERR, "{PDFv2Plugin.conversion_needs_pdfbox}\n", ($self->{'convert_to'}, "pretty_html"));
-#	$self->{'convert_to'} = "pretty_html";
-    }
-    elsif ($self->{'convert_to'} =~ /^pagedimg/) {
-	&gsprintf::gsprintf(STDERR, "{PDFv2Plugin.conversion_needs_pdfbox}\n", ($self->{'convert_to'}, "paged_pretty_html"));
-#	$self->{'convert_to'} = "paged_pretty_html";
-    }
-    elsif ($self->{'convert_to'} =~ /^paged_text$/) {
-	# TODO
-	print STDERR "@@@ Conversion to " . $self->{'convert_to'} , " with Xpdf Tools is not yet implemented.\n";
-	#print STDERR "@@@ Converting to text instead.\n";
-	#$self->{'convert_to'} = "text";
-    }
-    
     # PDFv2Plugin now supports PDF to txt conversion on Windows too:
     # using XPDF Tools (incl pdftotext) on Windows/Linux/Mac
-    elsif ($self->{'convert_to'} eq "text" && $ENV{'GSDLOS'} =~ /^windows$/i) {
+    if ($self->{'convert_to'} eq "text" && $ENV{'GSDLOS'} =~ /^windows$/i) {
 	&gsprintf::gsprintf(STDERR, "{PDFv2Plugin.win_pdftotext_info}\n");
     }
@@ -193,4 +174,29 @@
 	}
     }
+
+    # if pdfbox_conversion is not on, check convert_to to make sure that xpdftools can
+    # support the selected output format, or fallback on a sensible default
+    # Not all available conversion output options are possible with xpdftools, as some are
+    # only handled by pdfbox. If a format is unavailable with xpdftools, default to pretty_html
+    if (!$self->{"pdfbox_conversion"}) {
+	my $convert_to = $self->{'convert_to'};
+	my $fallback_convert_to = $convert_to;
+	if($convert_to =~ /^html$/) {
+	    $fallback_convert_to = "pretty_html";
+	}
+	elsif ($self->{'convert_to'} =~ /^pagedimg/) {
+	    $fallback_convert_to = "paged_pretty_html";
+	}
+	elsif ($self->{'convert_to'} =~ /^paged_text$/) {
+	    #	print STDERR "@@@ Conversion to " . $self->{'convert_to'} , " with Xpdf Tools is not yet implemented.\n";
+	    $fallback_convert_to = "text";
+	}
+
+	if($convert_to =~ /^(html|pagedimg|paged_text)/) {
+	    &gsprintf::gsprintf(STDERR, "{PDFv2Plugin.conversion_needs_pdfbox}\n", ($self->{'convert_to'}, $fallback_convert_to));
+	    $self->{'convert_to'} = $fallback_convert_to;
+	}
+    }
+    
     # set convert_to_plugin and convert_to_ext
     $self->set_standard_convert_settings();
@@ -310,4 +316,11 @@
 
     my $self = shift (@_);
+    
+    if($self->{'convert_to'} =~ m/pretty_html$/) { # if outputting paged_pretty_html or pretty_html:
+	# only xpdftools can output pretty_html regardless of whether pdfbox_conversion is switched on
+	print STDERR "@@@@ PDFBox_conversion is switched on, but pretty_html variants are generated by xpdftools.\n";
+	return $self->ConvertBinaryFile::tmp_area_convert_file(@_);
+    }
+    # else, output format uses pdfbox:
     return $self->AutoLoadConverters::tmp_area_convert_file(@_);
 
@@ -319,5 +332,5 @@
     my ($tmp_dirname, $tmp_inputPDFname, $utf8_tailname, $lc_suffix, $tailname, $suffix) = @_;    
 
-    if($self->{'convert_to'} !~ /pretty_html/) {
+    if($self->{'convert_to'} !~ m/pretty_html$/) {
 	return $self->ConvertBinaryFile::run_conversion_command(@_);
     }
Index: /main/trunk/greenstone2/perllib/strings.properties
===================================================================
--- /main/trunk/greenstone2/perllib/strings.properties	(revision 32282)
+++ /main/trunk/greenstone2/perllib/strings.properties	(revision 32283)
@@ -1199,5 +1199,5 @@
 PDFv2Plugin.win_pdftotext_info:PDFv2Plugin uses Xpdf Tools to support pdf to text conversion, including on Windows.
 
-PDFv2Plugin.conversion_needs_pdfbox:*** Conversion to %s not supported with Xpdf Tools, defaulting to %s. Turn on pdfbox_conversion if you wish to enable output to selected format.
+PDFv2Plugin.conversion_needs_pdfbox:*** Conversion to %s not supported with Xpdf Tools, defaulting to %s.\nTurn on pdfbox_conversion if you wish to enable output to the selected format.
 
 PostScriptPlugin.desc:This is a \"poor man's\" ps to text converter. If you are serious, consider using the PRESCRIPT package, which is available for download at http://www.nzdl.org/html/software.html
