diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 846266ac2e8a5ce3ab696defb5ecd7242974911f..51a8df661afe56397a5af840de5100b0ac6f51c7 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -39,7 +39,7 @@ StringXString GeneralOptions_String[] = {
     "Z-axis label" },
 
   { F|O, "BackgroundImageFileName" , opt_general_background_image_filename , "" ,
-    "Background image file in JPEG or PNG format" },
+    "Background image file in JPEG, PNG or PDF format" },
 
   { F|O, "DefaultFileName" , opt_general_default_filename , "untitled.geo" ,
     "Default project file name" },
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 6e6d7fca73478700d9443b99ffdb1fa94cabca87..22b0bbd544cb89a77def707049aa9f788913679a 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1088,8 +1088,17 @@ std::string opt_general_display(OPT_ARGS_STR)
 
 std::string opt_general_background_image_filename(OPT_ARGS_STR)
 {
-  if(action & GMSH_SET)
+  if(action & GMSH_SET){
+#if defined(HAVE_FLTK)
+    if(CTX::instance()->bgImageFileName != val && FlGui::available()){
+      for(unsigned int i = 0; i < FlGui::instance()->graph.size(); i++)
+        for(unsigned int j = 0; j < FlGui::instance()->graph[i]->gl.size(); j++)
+          FlGui::instance()->graph[i]->gl[j]->getDrawContext()->
+            invalidateBgImageTexture();
+    }
+#endif
     CTX::instance()->bgImageFileName = val;
+  }
   return CTX::instance()->bgImageFileName;
 }
 
diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp
index 618178b76a234b00f16d6fdd55025158e9bda5e5..14cf9d7b66e2c45f9936db162a370d7edefe35bd 100644
--- a/Graphics/drawContext.cpp
+++ b/Graphics/drawContext.cpp
@@ -356,6 +356,12 @@ void drawContext::drawBackgroundGradient()
   }
 }
 
+void drawContext::invalidateBgImageTexture()
+{
+  if(_bgImageTexture) glDeleteTextures(1, &_bgImageTexture);
+  _bgImageTexture = 0;
+}
+
 void drawContext::drawBackgroundImage(bool threeD)
 {
   if(CTX::instance()->bgImageFileName.empty() ||
@@ -373,16 +379,20 @@ void drawContext::drawBackgroundImage(bool threeD)
 
   if(ext == ".pdf" || ext == ".PDF"){
 #if defined(HAVE_POPPLER)
-    if(!gmshPopplerWrapper::instance()->hasFile()){
+    if(!_bgImageTexture){
       if(!gmshPopplerWrapper::instance()->loadFromFile(name)){
         Msg::Error("Could not load PDF file '%s'", name.c_str());
         CTX::instance()->bgImageFileName.clear();
         return;
       }
+      _bgImageTexture = gmshPopplerWrapper::getTextureForPage(1024, 1024);
+      _bgImageW = gmshPopplerWrapper::width();
+      _bgImageH = gmshPopplerWrapper::height();
     }
-    _bgImageTexture = gmshPopplerWrapper::getTextureForPage(1024, 1024);
-    _bgImageW = gmshPopplerWrapper::width();
-    _bgImageH = gmshPopplerWrapper::height();
+#else
+    Msg::Error("Gmsh must be compiled with Poppler support to load PDFs");
+    CTX::instance()->bgImageFileName.clear();
+    return;
 #endif
   }
   else{
@@ -393,26 +403,28 @@ void drawContext::drawBackgroundImage(bool threeD)
         img = new Fl_JPEG_Image(name.c_str());
       else if(ext == ".png" || ext == ".PNG")
         img = new Fl_PNG_Image(name.c_str());
-      if(img){
-        Fl_RGB_Image *img2 = (Fl_RGB_Image*)img->copy(1024, 1024);
-        glGenTextures(1, &_bgImageTexture);
-        glBindTexture(GL_TEXTURE_2D, _bgImageTexture);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img2->w(), img2->h(), 0,
-                     (img2->d() == 4) ? GL_RGBA : GL_RGB,
-                     GL_UNSIGNED_BYTE, img2->array);
-        _bgImageW = img2->w();
-        _bgImageH = img2->h();
-        delete img;
-        delete img2;
-      }
-      else{
+      if(!img){
         Msg::Error("Could not load background image '%s'", name.c_str());
         CTX::instance()->bgImageFileName.clear();
         return;
       }
+      Fl_RGB_Image *img2 = (Fl_RGB_Image*)img->copy(1024, 1024);
+      glGenTextures(1, &_bgImageTexture);
+      glBindTexture(GL_TEXTURE_2D, _bgImageTexture);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img2->w(), img2->h(), 0,
+                   (img2->d() == 4) ? GL_RGBA : GL_RGB,
+                   GL_UNSIGNED_BYTE, img2->array);
+      _bgImageW = img2->w();
+      _bgImageH = img2->h();
+      delete img;
+      delete img2;
     }
+#else
+    Msg::Error("Gmsh must be compiled with FLTK support to load JPEGs or PNGs");
+    CTX::instance()->bgImageFileName.clear();
+    return;
 #endif
   }
 
diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h
index ffcd9d57fa108394bdc6310eaef04c01cf45e2f6..2f1285f283c7f2260dae09af034a7a4edb443b8c 100644
--- a/Graphics/drawContext.h
+++ b/Graphics/drawContext.h
@@ -177,6 +177,7 @@ class drawContext {
   bool isVisible(PView *v){ return (_hiddenViews.find(v) == _hiddenViews.end()); }
   void createQuadricsAndDisplayLists();
   void invalidateQuadricsAndDisplayLists();
+  void invalidateBgImageTexture();
   void buildRotationMatrix();
   void setQuaternion(double p1x, double p1y, double p2x, double p2y);
   void addQuaternion(double p1x, double p1y, double p2x, double p2y);