diff --git a/fillpdf.admin.inc b/fillpdf.admin.inc
index 205347e..1a3a274 100644
--- a/fillpdf.admin.inc
+++ b/fillpdf.admin.inc
@@ -36,14 +36,10 @@ function fillpdf_settings($form, &$form_state) {
   }
 
   // Check for pdftk.
-  $output = array();
-  $status = NULL;
-  exec('pdftk', $output, $status);
-  if (in_array($status, array(126, 127))) {
+  $status = fillpdf_pdftk_check(variable_get('fillpdf_pdftk_path', 'pdftk'));
+  if ($status === FALSE) {
     $options['pdftk'] .= '<div class="messages warning">' . t('pdftk is not properly installed.') . '</div>';
   }
-  unset($output);
-  unset($status);
 
   $form['fillpdf_service'] = array(
     '#type' => 'radios',
@@ -75,12 +71,26 @@ function fillpdf_settings($form, &$form_state) {
       'http' => t('Do not use HTTPS'),
       ),
   );
+  $form['fillpdf_pdftk_path'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Configure path to pdftk'),
+    '#description' => t("If Fill PDF is not detecting your pdftk installation, you can specify the full path to the program here. Include the program name as well. For example, <em>/usr/bin/pdftk</em> is a valid value. You can almost always leave this field blank. If you should set it, you'll probably know."),
+    '#default_value' => variable_get('fillpdf_pdftk_path'),
+  );
 
   drupal_add_js(drupal_get_path('module', 'fillpdf') . '/fillpdf.js');
 
   return system_settings_form($form);
 }
 
+function fillpdf_settings_validate($form, &$form_state) {
+  $status = fillpdf_pdftk_check($form_state['values']['fillpdf_pdftk_path']);
+  if ($status === FALSE) {
+    form_set_error('fillpdf_pdftk_path', t('The path you have entered for
+    <em>pdftk</em> is invalid. Please enter a valid path.'));
+  }
+}
+
 
 /* ---------------- Form Create --------------------*/
 
diff --git a/fillpdf.module b/fillpdf.module
index e3a5d0f..fdfd99f 100644
--- a/fillpdf.module
+++ b/fillpdf.module
@@ -713,9 +713,11 @@ function fillpdf_execute_merge($method, $fields, $fillpdf, $mode = 'url', $flatt
       $xfdf = create_xfdf(basename($xfdfname), $fields);
       // Generate the file
       $xfdffile = file_save_data($xfdf, $xfdfname, FILE_EXISTS_RENAME);
+
       // Now feed this to pdftk and save the result to a variable
+      $path_to_pdftk = variable_get('fillpdf_pdftk_path', 'pdftk');
       ob_start();
-      passthru('pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' fill_form ' . escapeshellarg(drupal_realpath($xfdffile->uri)) . ' output - ' . ($flatten ? 'flatten ' : '') . 'drop_xfa');
+      passthru($path_to_pdftk . ' ' . escapeshellarg(drupal_realpath($filename)) . ' fill_form ' . escapeshellarg(drupal_realpath($xfdffile->uri)) . ' output - ' . ($flatten ? 'flatten ' : '') . 'drop_xfa');
       $data = ob_get_clean();
       if ($data === FALSE) {
         drupal_set_message(t('pdftk not properly installed. No PDF generated.'), 'error');
@@ -734,7 +736,6 @@ function fillpdf_execute_merge($method, $fields, $fillpdf, $mode = 'url', $flatt
   }
 }
 
-
 /**
  * This function generates the form fields from the specified PDF.  It (1) sends a request to the iText
  * servlet to parse the specified PDF, (2) iText returns an XML response with fields-mappings, this module
@@ -810,15 +811,18 @@ function fillpdf_execute_parse($method, $fillpdf, $mode = 'url') {
       $filename = file_unmanaged_save_data($fillpdf, file_directory_temp() . '/pdf_data.pdf', FILE_EXISTS_RENAME);
       break;
   }
-  // Use exec() to call pdftk (because it will be easier to go line-by-line parsing the output) and pass $content via stdin. Retrieve the fields with dump_data_fields.
-  $output = array();
-  $status = NULL;
-  exec('pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' dump_data_fields', $output, $status);
-  if (in_array($status, array(126, 127))) {
+
+  $path_to_pdftk = variable_get('fillpdf_pdftk_path', 'pdftk');
+  $status = fillpdf_pdftk_check($path_to_pdftk);
+  if ($status === FALSE) {
     drupal_set_message(t('pdftk not properly installed.'), 'error');
     return array();
   }
-  elseif (count($output) === 0) {
+
+  // Use exec() to call pdftk (because it will be easier to go line-by-line parsing the output) and pass $content via stdin. Retrieve the fields with dump_data_fields.
+  $output = array();
+  exec($path_to_pdftk . ' ' . escapeshellarg(drupal_realpath($filename)) . ' dump_data_fields', $output, $status);
+  if (count($output) === 0) {
     drupal_set_message(t('PDF does not contain fillable fields.'), 'warning');
     return array();
   }
@@ -1001,3 +1005,13 @@ function fillpdf_load($fid, $reset = FALSE) {
   }
 }
 
+function fillpdf_pdftk_check($pdftk_path = 'pdftk') {
+  $output = array();
+  $status = NULL;
+  exec($pdftk_path, $output, $status);
+  if (in_array($status, array(126, 127))) {
+    return FALSE;
+  }
+  return TRUE;
+}
+
