diff --git a/xfdf.inc b/xfdf.inc
index 6e17d97bf93a3a3f4ba0215d91059a23a1cfcc05..6859f74ecda4cb475334c12a6710e34e77a87f53 100644
--- a/xfdf.inc
+++ b/xfdf.inc
@@ -8,8 +8,9 @@
 /**
  * Generates an XFDF file from values given in an associative array.
  *
- * @param string $file
- *   The PDF file: URL or file path accepted.
+ * @param string|null $file
+ *   The PDF file: URL or file path accepted. Use NULL to skip setting
+ *   file-related properties.
  * @param array $info
  *   Key/value pairs of the field data.
  * @param string $enc
@@ -35,11 +36,15 @@ function create_xfdf($file, $info, $enc = 'UTF-8') {
   }
 
   $ids_ele = $xfdf_ele->appendChild($doc->createElement('ids'));
-  $ids_ele->setAttribute('original', md5($file));
+  if ($file) {
+    $ids_ele->setAttribute('original', md5($file));
+  }
   $ids_ele->setAttribute('modified', REQUEST_TIME);
 
-  $f_ele = $xfdf_ele->appendChild($doc->createElement('f'));
-  $f_ele->setAttribute('href', $file);
+  if ($file) {
+    $f_ele = $xfdf_ele->appendChild($doc->createElement('f'));
+    $f_ele->setAttribute('href', $file);
+  }
 
   return $doc->saveXML();
 }