 -- instead
 pageRender :: PageClass page => page
  -> Render ()
-pageRender page = 
+pageRender page =
   ask >>= \ x -> liftIO ({#call poppler_page_render #} (toPage page) x)
 
 -- | First scale the document to match the specified pixels per point, then render the rectangle given by

    pageGetFormFieldMapping,
    pageGetSelectionRegion,
    pageRenderSelection,
    -- pageRenderSelectionToPixbuf,
    ) where


-- thumbnail exists.
pageGetThumbnailSize :: PageClass page => page
 -> IO (Maybe (Int, Int))
pageGetThumbnailSize page =
  alloca $ \ widthPtr ->
  alloca $ \ heightPtr -> do
    success <- liftM toBool $
                {#call poppler_page_get_thumbnail_size #}
                  (toPage page)
                  widthPtr
                  heightPtr
    if success
       then do
         width  <- peek widthPtr
         height <- peek heightPtr
         return $ Just (fromIntegral width, fromIntegral height)
       else return Nothing

-- | Render the page on a postscript file
pageRenderToPs :: (PageClass page, PSFileClass psFile) => page -> psFile -> IO ()
pageRenderToPs page psFile =
  {#call poppler_page_render_to_ps #} (toPage page) (toPSFile psFile)

-- | A GList of rectangles for each occurance of the text on the page. The coordinates are in PDF points.
pageFindText :: PageClass page => page
 -> String  -- ^ @text@    the text to search for (UTF-8 encoded)
 -> IO [PopplerRectangle]
pageFindText page text =
  withUTFString text $ \ textPtr -> do
    glistPtr <- {#call poppler_page_find_text #} (toPage page) textPtr
    list <- fromGList glistPtr
    mapM peekPopplerRectangle list

-- | Retrieves the contents of the specified selection as text.
pageGetText :: PageClass page => page -> IO String  -- ^ returns selection string
pageGetText page =
  {#call poppler_page_get_text #} (toPage page)
  >>= peekUTFString

-- | Returns the duration of page
pageGetDuration :: PageClass page => page
 -> IO Double  -- ^ returns duration in seconds of page or -1.
pageGetDuration page =
  liftM realToFrac $
  {#call poppler_page_get_duration #} (toPage page)

-- | Returns the transition effect of page
pageGetTransition :: PageClass page => page
 -> IO (Maybe PageTransition) -- ^ returns a 'PageTransition' or 'Nothing'.
pageGetTransition page = do
  ptr <- {#call poppler_page_get_transition #} (toPage page)
  if ptr == nullPtr
