Index: cups-filters-1.28.17/filter/pdftopdf/qpdf_pdftopdf_processor.cc
===================================================================
--- cups-filters-1.28.17.orig/filter/pdftopdf/qpdf_pdftopdf_processor.cc
+++ cups-filters-1.28.17/filter/pdftopdf/qpdf_pdftopdf_processor.cc
@@ -83,10 +83,10 @@ QPDFObjectHandle QPDF_PDFTOPDF_PageHandl
     page.getKey("/Resources").replaceKey("/XObject",QPDFObjectHandle::newDictionary(xobjs));
     content.append("Q\n");
     page.getKey("/Contents").replaceStreamData(content,QPDFObjectHandle::newNull(),QPDFObjectHandle::newNull());
-    page.replaceOrRemoveKey("/Rotate",makeRotate(rotation));
+    page.replaceKey("/Rotate",makeRotate(rotation));
   } else {
     Rotation rot=getRotate(page)+rotation;
-    page.replaceOrRemoveKey("/Rotate",makeRotate(rot));
+    page.replaceKey("/Rotate",makeRotate(rot));
   }
   page=QPDFObjectHandle(); // i.e. uninitialized
   return ret;
@@ -181,9 +181,9 @@ Rotation QPDF_PDFTOPDF_PageHandle::crop(
   page.assertInitialized();
   Rotation save_rotate = getRotate(page);
   if(orientation==ROT_0||orientation==ROT_180)
-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_90));
+    page.replaceKey("/Rotate",makeRotate(ROT_90));
   else
-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_0));
+    page.replaceKey("/Rotate",makeRotate(ROT_0));
 
   PageRect currpage= getBoxAsRect(getTrimBox(page));
   double width = currpage.right-currpage.left;
@@ -242,7 +242,7 @@ Rotation QPDF_PDFTOPDF_PageHandle::crop(
   //Cropping.
   // TODO: Borders are covered by the image. buffer space?
   page.replaceKey("/TrimBox",makeBox(currpage.left,currpage.bottom,currpage.right,currpage.top));
-  page.replaceOrRemoveKey("/Rotate",makeRotate(save_rotate));
+  page.replaceKey("/Rotate",makeRotate(save_rotate));
   return getRotate(page);
 }
 
@@ -251,14 +251,14 @@ bool QPDF_PDFTOPDF_PageHandle::is_landsc
   page.assertInitialized();
   Rotation save_rotate = getRotate(page);
   if(orientation==ROT_0||orientation==ROT_180)
-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_90));
+    page.replaceKey("/Rotate",makeRotate(ROT_90));
   else
-    page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_0));
+    page.replaceKey("/Rotate",makeRotate(ROT_0));
 
   PageRect currpage= getBoxAsRect(getTrimBox(page));
   double width = currpage.right-currpage.left;
   double height = currpage.top-currpage.bottom;
-  page.replaceOrRemoveKey("/Rotate",makeRotate(save_rotate));
+  page.replaceKey("/Rotate",makeRotate(save_rotate));
   if(width>height)
     return true;
   return false;
@@ -662,7 +662,7 @@ void QPDF_PDFTOPDF_Processor::autoRotate
       // TODO? other rotation direction, e.g. if (src_rot==ROT_0)&&(param.orientation==ROT_270) ... etc.
       // rotation=ROT_270;
 
-      page.replaceOrRemoveKey("/Rotate",makeRotate(src_rot+rotation));
+      page.replaceKey("/Rotate",makeRotate(src_rot+rotation));
     }
   }
 }
Index: cups-filters-1.28.17/filter/pdf.cxx
===================================================================
--- cups-filters-1.28.17.orig/filter/pdf.cxx
+++ cups-filters-1.28.17/filter/pdf.cxx
@@ -26,6 +26,7 @@
 #include <qpdf/QPDFWriter.hh>
 #include <qpdf/QPDFAcroFormDocumentHelper.hh>
 #include <qpdf/QPDFPageDocumentHelper.hh>
+#include <qpdf/PointerHolder.hh>
 
 /*
  * Useful reference:
Index: cups-filters-1.28.17/filter/pdftopdf/qpdf_xobject.cc
===================================================================
--- cups-filters-1.28.17.orig/filter/pdftopdf/qpdf_xobject.cc
+++ cups-filters-1.28.17/filter/pdftopdf/qpdf_xobject.cc
@@ -4,6 +4,7 @@
 #include <qpdf/Pl_Discard.hh>
 #include <qpdf/Pl_Count.hh>
 #include <qpdf/Pl_Concatenate.hh>
+#include <qpdf/PointerHolder.hh>
 #include "qpdf_tools.h"
 #include "qpdf_pdftopdf.h"
 
Index: cups-filters-1.28.17/filter/rastertopdf.cpp
===================================================================
--- cups-filters-1.28.17.orig/filter/rastertopdf.cpp
+++ cups-filters-1.28.17/filter/rastertopdf.cpp
@@ -45,6 +45,7 @@
 
 #include <qpdf/Pl_Flate.hh>
 #include <qpdf/Pl_Buffer.hh>
+#include <qpdf/PointerHolder.hh>
 #ifdef QPDF_HAVE_PCLM
 #include <qpdf/Pl_RunLength.hh>
 #include <qpdf/Pl_DCT.hh>
Index: cups-filters-1.28.17/filter/urftopdf.cpp
===================================================================
--- cups-filters-1.28.17.orig/filter/urftopdf.cpp
+++ cups-filters-1.28.17/filter/urftopdf.cpp
@@ -38,6 +38,7 @@
 
 #include <qpdf/Pl_Flate.hh>
 #include <qpdf/Pl_Buffer.hh>
+#include <qpdf/PointerHolder.hh>
 
 #include "unirast.h"
 
