diff --git a/CMakeLists.txt b/CMakeLists.txt
index a00682c105561ce9f4c491d320b6a0d1d2d2057d..69b88e22da39779c470a9ebfd9ef8851b828c401 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,7 +49,7 @@ option(ENABLE_PNG "Enable PNG support" ON)
 
 set(GL2PS_MAJOR_VERSION 1)
 set(GL2PS_MINOR_VERSION 3)
-set(GL2PS_PATCH_VERSION 4)
+set(GL2PS_PATCH_VERSION 5)
 set(GL2PS_EXTRA_VERSION "" CACHE STRING "GL2PS extra version string")
 
 set(GL2PS_VERSION "${GL2PS_MAJOR_VERSION}.${GL2PS_MINOR_VERSION}")
diff --git a/gl2ps.c b/gl2ps.c
index f7b236dbd68ca84d2d39b38fc8a3480e70a8a1a4..e63b24d0baecabb36f21921a4cb011dd7391247d 100644
--- a/gl2ps.c
+++ b/gl2ps.c
@@ -4471,27 +4471,29 @@ static int gl2psPrintPDFPixmapStreamData(GL2PSimage *im,
                                                           size_t size), 
                                          int gray)
 {
-  int x, y;
+  int x, y, shift;
   GLfloat r, g, b, a;
 
   if(im->format != GL_RGBA && gray)
     return 0;
 
-  if(gray && gray !=8 && gray != 16)
+  if(gray && gray != 8 && gray != 16)
     gray = 8;
 
   gray /= 8;
   
+  shift = (sizeof(unsigned long) - 1) * 8;
+
   for(y = 0; y < im->height; ++y){
     for(x = 0; x < im->width; ++x){
       a = gl2psGetRGB(im, x, y, &r, &g, &b);
       if(im->format == GL_RGBA && gray){
-        (*action)((unsigned long)(a*255) << 24, gray);
+        (*action)((unsigned long)(a * 255) << shift, gray);
       }
       else{
-        (*action)((unsigned long)(r*255) << 24, 1);
-        (*action)((unsigned long)(g*255) << 24, 1);
-        (*action)((unsigned long)(b*255) << 24, 1);
+        (*action)((unsigned long)(r * 255) << shift, 1);
+        (*action)((unsigned long)(g * 255) << shift, 1);
+        (*action)((unsigned long)(b * 255) << shift, 1);
       }
     }
   }
diff --git a/gl2ps.h b/gl2ps.h
index 34b7fdb9a60f83d5c52bba4b66271b86927f06a7..9dbb726b41a08d4fdbf6efc3410f7cfda2c15020 100644
--- a/gl2ps.h
+++ b/gl2ps.h
@@ -80,7 +80,7 @@
 
 #define GL2PS_MAJOR_VERSION 1
 #define GL2PS_MINOR_VERSION 3
-#define GL2PS_PATCH_VERSION 4
+#define GL2PS_PATCH_VERSION 5
 #define GL2PS_EXTRA_VERSION ""
 
 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
diff --git a/gl2ps.tex b/gl2ps.tex
index 31beab7526b98beab68e06479a4d6fc43c7a0971..8cee26cf2739e36e779edb8291f98e22a39ffc28 100644
--- a/gl2ps.tex
+++ b/gl2ps.tex
@@ -1,4 +1,4 @@
-%  $Id: gl2ps.tex,v 1.2 2009-10-02 23:32:24 geuzaine Exp $
+%  $Id: gl2ps.tex,v 1.3 2009-10-11 22:07:21 geuzaine Exp $
 %
 %  GL2PS, an OpenGL to PostScript Printing Library
 %  Copyright (C) 1999-2009 C. Geuzaine
@@ -63,7 +63,7 @@
 
 \title{GL2PS: an OpenGL to PostScript printing library}
 \author{Christophe Geuzaine}
-\date{Version 1.3.4, September 30 2009}
+\date{Version 1.3.5, October 12 2009}
 
 \maketitle
 
@@ -96,7 +96,7 @@ the OpenGL window.</em></small></td>
 </center>
 <h2>Download</h2>
 The latest stable version of GL2PS is
-<a href="http://geuz.org/gl2ps/src/gl2ps-1.3.4.tgz">gl2ps-1.3.4.tgz</a>.
+<a href="http://geuz.org/gl2ps/src/gl2ps-1.3.5.tgz">gl2ps-1.3.5.tgz</a>.
 Older versions and nightly CVS snapshots are available 
 <a href="http://geuz.org/gl2ps/src/">here</a>.
 <p>
@@ -870,18 +870,19 @@ stippling pattern parser bug report;
 \noemail{Jason Anderssen}{janderssen@exactal.com} for memory leak fix
 in pdf code;
 %
-\noemail{Sylvestre Ledru}{sylvestre.ledru@scilab.org} for SVG patches.
+\noemail{Sylvestre Ledru}{sylvestre.ledru@scilab.org} for SVG patches;
+%
+\noemail{Calixte Denizet}{Calixte.Denizet@ac-rennes.fr} for 64 bit patch.
 
 \section{Links}
 \label{sec:links}
 
-Projects similar to \dd{GL2PS} include: Mark Kilgard's original
-``rendereps'' tutorial
-(\url{http://www.opengl.org/resources/code/samples/mjktips/Feedback.html});
-Michael Sweet's GLP library
-(\url{http://www.easysw.com/~mike/opengl/}); the GLpr library from CEI
-international (\url{http://www.ceintl.com/}; this product does not
-seem to be available anymore).
+\dd{GL2PS} was inspired by Mark Kilgard's original ``rendereps'' tutorial
+(\url{http://www.opengl.org/resources/code/samples/mjktips/Feedback.html})
+and Michael Sweet's GLP library (\url{http://www.easysw.com/~mike/opengl/}).
+The (commercial) GLpr library from CEI (\url{http://www.ceintl.com/}) used
+to provide functionality similar to GL2PS but does not seem to be available
+anymore.
 
 %\noemail{Toby White}{tow@sdf.lonestar.org} maintains a Python wrapper for
 %\dd{GL2PS}, available at \url{http://tow.freeshell.org/software.html}.
@@ -1010,6 +1011,8 @@ seem to be available anymore).
   fixed possible divisions by zero.
 \item[1.3.4] (Sep 30, 2009) Added support for rotated text in SVG output;
   fixed MSVC warnings.
+\item[1.3.5] (Oct 12, 2009) Fixed PDF image output when compiled in 64 bit
+  mode; added cmake build file.
 \end{description}
 
 \special{html:<p>