{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Poppler.Objects.Page
    ( 

-- * Exported types
    Page(..)                                ,
    PageK                                   ,
    toPage                                  ,
    noPage                                  ,


 -- * Methods
-- ** pageAddAnnot
    pageAddAnnot                            ,


-- ** pageFindText
    pageFindText                            ,


-- ** pageFindTextWithOptions
    pageFindTextWithOptions                 ,


-- ** pageFreeAnnotMapping
    pageFreeAnnotMapping                    ,


-- ** pageFreeFormFieldMapping
    pageFreeFormFieldMapping                ,


-- ** pageFreeImageMapping
    pageFreeImageMapping                    ,


-- ** pageFreeLinkMapping
    pageFreeLinkMapping                     ,


-- ** pageFreeTextAttributes
    pageFreeTextAttributes                  ,


-- ** pageGetAnnotMapping
    pageGetAnnotMapping                     ,


-- ** pageGetCropBox
    pageGetCropBox                          ,


-- ** pageGetDuration
    pageGetDuration                         ,


-- ** pageGetFormFieldMapping
    pageGetFormFieldMapping                 ,


-- ** pageGetImage
    pageGetImage                            ,


-- ** pageGetImageMapping
    pageGetImageMapping                     ,


-- ** pageGetIndex
    pageGetIndex                            ,


-- ** pageGetLabel
    pageGetLabel                            ,


-- ** pageGetLinkMapping
    pageGetLinkMapping                      ,


-- ** pageGetSelectedRegion
    pageGetSelectedRegion                   ,


-- ** pageGetSelectedText
    pageGetSelectedText                     ,


-- ** pageGetSelectionRegion
    pageGetSelectionRegion                  ,


-- ** pageGetSize
    pageGetSize                             ,


-- ** pageGetText
    pageGetText                             ,


-- ** pageGetTextAttributes
    pageGetTextAttributes                   ,


-- ** pageGetTextAttributesForArea
    pageGetTextAttributesForArea            ,


-- ** pageGetTextForArea
    pageGetTextForArea                      ,


-- ** pageGetTextLayout
    pageGetTextLayout                       ,


-- ** pageGetTextLayoutForArea
    pageGetTextLayoutForArea                ,


-- ** pageGetThumbnail
    pageGetThumbnail                        ,


-- ** pageGetThumbnailSize
    pageGetThumbnailSize                    ,


-- ** pageGetTransition
    pageGetTransition                       ,


-- ** pageRemoveAnnot
    pageRemoveAnnot                         ,


-- ** pageRender
    pageRender                              ,


-- ** pageRenderForPrinting
    pageRenderForPrinting                   ,


-- ** pageRenderForPrintingWithOptions
    pageRenderForPrintingWithOptions        ,


-- ** pageRenderSelection
    pageRenderSelection                     ,


-- ** pageRenderToPs
    pageRenderToPs                          ,


-- ** pageSelectionRegionFree
    pageSelectionRegionFree                 ,




 -- * Properties
-- ** Label
    PageLabelPropertyInfo                   ,
    getPageLabel                            ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Poppler.Types
import GI.Poppler.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Cairo as Cairo

newtype Page = Page (ForeignPtr Page)
foreign import ccall "poppler_page_get_type"
    c_poppler_page_get_type :: IO GType

type instance ParentTypes Page = PageParentTypes
type PageParentTypes = '[GObject.Object]

instance GObject Page where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_page_get_type
    

class GObject o => PageK o
instance (GObject o, IsDescendantOf Page o) => PageK o

toPage :: PageK o => o -> IO Page
toPage = unsafeCastTo Page

noPage :: Maybe Page
noPage = Nothing

-- VVV Prop "label"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getPageLabel :: (MonadIO m, PageK o) => o -> m T.Text
getPageLabel obj = liftIO $ getObjectPropertyString obj "label"

data PageLabelPropertyInfo
instance AttrInfo PageLabelPropertyInfo where
    type AttrAllowedOps PageLabelPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint PageLabelPropertyInfo = (~) ()
    type AttrBaseTypeConstraint PageLabelPropertyInfo = PageK
    type AttrGetType PageLabelPropertyInfo = T.Text
    type AttrLabel PageLabelPropertyInfo = "Page::label"
    attrGet _ = getPageLabel
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList Page = PageAttributeList
type PageAttributeList = ('[ '("label", PageLabelPropertyInfo)] :: [(Symbol, *)])

type instance SignalList Page = PageSignalList
type PageSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Page::add_annot
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "annot", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "annot", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_add_annot" poppler_page_add_annot :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Annot ->                            -- annot : TInterface "Poppler" "Annot"
    IO ()


pageAddAnnot ::
    (MonadIO m, PageK a, AnnotK b) =>
    a ->                                    -- _obj
    b ->                                    -- annot
    m ()
pageAddAnnot _obj annot = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let annot' = unsafeManagedPtrCastPtr annot
    poppler_page_add_annot _obj' annot'
    touchManagedPtr _obj
    touchManagedPtr annot
    return ()

-- method Page::find_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "Rectangle")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_find_text" poppler_page_find_text :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    CString ->                              -- text : TBasicType TUTF8
    IO (Ptr (GList (Ptr Rectangle)))


pageFindText ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- text
    m [Rectangle]
pageFindText _obj text = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    text' <- textToCString text
    result <- poppler_page_find_text _obj' text'
    checkUnexpectedReturnNULL "poppler_page_find_text" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed Rectangle) result'
    g_list_free result
    touchManagedPtr _obj
    freeMem text'
    return result''

-- method Page::find_text_with_options
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "options", argType = TInterface "Poppler" "FindFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "options", argType = TInterface "Poppler" "FindFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "Rectangle")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_find_text_with_options" poppler_page_find_text_with_options :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    CString ->                              -- text : TBasicType TUTF8
    CUInt ->                                -- options : TInterface "Poppler" "FindFlags"
    IO (Ptr (GList (Ptr Rectangle)))


pageFindTextWithOptions ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- text
    [FindFlags] ->                          -- options
    m [Rectangle]
pageFindTextWithOptions _obj text options = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    text' <- textToCString text
    let options' = gflagsToWord options
    result <- poppler_page_find_text_with_options _obj' text' options'
    checkUnexpectedReturnNULL "poppler_page_find_text_with_options" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed Rectangle) result'
    g_list_free result
    touchManagedPtr _obj
    freeMem text'
    return result''

-- method Page::get_annot_mapping
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "AnnotMapping")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_annot_mapping" poppler_page_get_annot_mapping :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr (GList (Ptr AnnotMapping)))


pageGetAnnotMapping ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m [AnnotMapping]
pageGetAnnotMapping _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_annot_mapping _obj'
    checkUnexpectedReturnNULL "poppler_page_get_annot_mapping" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed AnnotMapping) result'
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method Page::get_crop_box
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_crop_box" poppler_page_get_crop_box :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    IO ()


pageGetCropBox ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m (Rectangle)
pageGetCropBox _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    rect <- callocBoxedBytes 32 :: IO (Ptr Rectangle)
    poppler_page_get_crop_box _obj' rect
    rect' <- (wrapBoxed Rectangle) rect
    touchManagedPtr _obj
    return rect'

-- method Page::get_duration
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TDouble
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_duration" poppler_page_get_duration :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO CDouble


pageGetDuration ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m Double
pageGetDuration _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_duration _obj'
    let result' = realToFrac result
    touchManagedPtr _obj
    return result'

-- method Page::get_form_field_mapping
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "FormFieldMapping")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_form_field_mapping" poppler_page_get_form_field_mapping :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr (GList (Ptr FormFieldMapping)))


pageGetFormFieldMapping ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m [FormFieldMapping]
pageGetFormFieldMapping _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_form_field_mapping _obj'
    checkUnexpectedReturnNULL "poppler_page_get_form_field_mapping" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed FormFieldMapping) result'
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method Page::get_image
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "image_id", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "image_id", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Surface"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_image" poppler_page_get_image :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Int32 ->                                -- image_id : TBasicType TInt32
    IO (Ptr Cairo.Surface)


pageGetImage ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- image_id
    m Cairo.Surface
pageGetImage _obj image_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_image _obj' image_id
    checkUnexpectedReturnNULL "poppler_page_get_image" result
    result' <- (wrapBoxed Cairo.Surface) result
    touchManagedPtr _obj
    return result'

-- method Page::get_image_mapping
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "ImageMapping")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_image_mapping" poppler_page_get_image_mapping :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr (GList (Ptr ImageMapping)))


pageGetImageMapping ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m [ImageMapping]
pageGetImageMapping _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_image_mapping _obj'
    checkUnexpectedReturnNULL "poppler_page_get_image_mapping" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed ImageMapping) result'
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method Page::get_index
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_index" poppler_page_get_index :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO Int32


pageGetIndex ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m Int32
pageGetIndex _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_index _obj'
    touchManagedPtr _obj
    return result

-- method Page::get_label
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_label" poppler_page_get_label :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO CString


pageGetLabel ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m T.Text
pageGetLabel _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_label _obj'
    checkUnexpectedReturnNULL "poppler_page_get_label" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method Page::get_link_mapping
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "LinkMapping")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_link_mapping" poppler_page_get_link_mapping :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr (GList (Ptr LinkMapping)))


pageGetLinkMapping ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m [LinkMapping]
pageGetLinkMapping _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_link_mapping _obj'
    checkUnexpectedReturnNULL "poppler_page_get_link_mapping" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed LinkMapping) result'
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method Page::get_selected_region
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Region"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_selected_region" poppler_page_get_selected_region :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    CDouble ->                              -- scale : TBasicType TDouble
    CUInt ->                                -- style : TInterface "Poppler" "SelectionStyle"
    Ptr Rectangle ->                        -- selection : TInterface "Poppler" "Rectangle"
    IO (Ptr Cairo.Region)


pageGetSelectedRegion ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Double ->                               -- scale
    SelectionStyle ->                       -- style
    Rectangle ->                            -- selection
    m Cairo.Region
pageGetSelectedRegion _obj scale style selection = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let scale' = realToFrac scale
    let style' = (fromIntegral . fromEnum) style
    let selection' = unsafeManagedPtrGetPtr selection
    result <- poppler_page_get_selected_region _obj' scale' style' selection'
    checkUnexpectedReturnNULL "poppler_page_get_selected_region" result
    result' <- (wrapBoxed Cairo.Region) result
    touchManagedPtr _obj
    touchManagedPtr selection
    return result'

-- method Page::get_selected_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_selected_text" poppler_page_get_selected_text :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    CUInt ->                                -- style : TInterface "Poppler" "SelectionStyle"
    Ptr Rectangle ->                        -- selection : TInterface "Poppler" "Rectangle"
    IO CString


pageGetSelectedText ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    SelectionStyle ->                       -- style
    Rectangle ->                            -- selection
    m T.Text
pageGetSelectedText _obj style selection = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let style' = (fromIntegral . fromEnum) style
    let selection' = unsafeManagedPtrGetPtr selection
    result <- poppler_page_get_selected_text _obj' style' selection'
    checkUnexpectedReturnNULL "poppler_page_get_selected_text" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    touchManagedPtr selection
    return result'

-- method Page::get_selection_region
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "Rectangle")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_selection_region" poppler_page_get_selection_region :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    CDouble ->                              -- scale : TBasicType TDouble
    CUInt ->                                -- style : TInterface "Poppler" "SelectionStyle"
    Ptr Rectangle ->                        -- selection : TInterface "Poppler" "Rectangle"
    IO (Ptr (GList (Ptr Rectangle)))

{-# DEPRECATED pageGetSelectionRegion ["(Since version 0.16)","Use poppler_page_get_selected_region() instead."]#-}
pageGetSelectionRegion ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Double ->                               -- scale
    SelectionStyle ->                       -- style
    Rectangle ->                            -- selection
    m [Rectangle]
pageGetSelectionRegion _obj scale style selection = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let scale' = realToFrac scale
    let style' = (fromIntegral . fromEnum) style
    let selection' = unsafeManagedPtrGetPtr selection
    result <- poppler_page_get_selection_region _obj' scale' style' selection'
    checkUnexpectedReturnNULL "poppler_page_get_selection_region" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed Rectangle) result'
    g_list_free result
    touchManagedPtr _obj
    touchManagedPtr selection
    return result''

-- method Page::get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "height", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_size" poppler_page_get_size :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr CDouble ->                          -- width : TBasicType TDouble
    Ptr CDouble ->                          -- height : TBasicType TDouble
    IO ()


pageGetSize ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m (Double,Double)
pageGetSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    width <- allocMem :: IO (Ptr CDouble)
    height <- allocMem :: IO (Ptr CDouble)
    poppler_page_get_size _obj' width height
    width' <- peek width
    let width'' = realToFrac width'
    height' <- peek height
    let height'' = realToFrac height'
    touchManagedPtr _obj
    freeMem width
    freeMem height
    return (width'', height'')

-- method Page::get_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_text" poppler_page_get_text :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO CString


pageGetText ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m T.Text
pageGetText _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_text _obj'
    checkUnexpectedReturnNULL "poppler_page_get_text" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method Page::get_text_attributes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "TextAttributes")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_text_attributes" poppler_page_get_text_attributes :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr (GList (Ptr TextAttributes)))


pageGetTextAttributes ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m [TextAttributes]
pageGetTextAttributes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_text_attributes _obj'
    checkUnexpectedReturnNULL "poppler_page_get_text_attributes" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed TextAttributes) result'
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method Page::get_text_attributes_for_area
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "area", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "area", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Poppler" "TextAttributes")
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_text_attributes_for_area" poppler_page_get_text_attributes_for_area :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Rectangle ->                        -- area : TInterface "Poppler" "Rectangle"
    IO (Ptr (GList (Ptr TextAttributes)))


pageGetTextAttributesForArea ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Rectangle ->                            -- area
    m [TextAttributes]
pageGetTextAttributesForArea _obj area = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let area' = unsafeManagedPtrGetPtr area
    result <- poppler_page_get_text_attributes_for_area _obj' area'
    checkUnexpectedReturnNULL "poppler_page_get_text_attributes_for_area" result
    result' <- unpackGList result
    result'' <- mapM (wrapBoxed TextAttributes) result'
    g_list_free result
    touchManagedPtr _obj
    touchManagedPtr area
    return result''

-- method Page::get_text_for_area
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "area", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "area", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_text_for_area" poppler_page_get_text_for_area :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Rectangle ->                        -- area : TInterface "Poppler" "Rectangle"
    IO CString


pageGetTextForArea ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Rectangle ->                            -- area
    m T.Text
pageGetTextForArea _obj area = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let area' = unsafeManagedPtrGetPtr area
    result <- poppler_page_get_text_for_area _obj' area'
    checkUnexpectedReturnNULL "poppler_page_get_text_for_area" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    touchManagedPtr area
    return result'

-- method Page::get_text_layout
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rectangles", argType = TCArray False (-1) 2 (TInterface "Poppler" "Rectangle"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferContainer},Arg {argName = "n_rectangles", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "n_rectangles", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_text_layout" poppler_page_get_text_layout :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr (Ptr Rectangle) ->                  -- rectangles : TCArray False (-1) 2 (TInterface "Poppler" "Rectangle")
    Ptr Word32 ->                           -- n_rectangles : TBasicType TUInt32
    IO CInt


pageGetTextLayout ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m (Bool,[Rectangle])
pageGetTextLayout _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    rectangles <- allocMem :: IO (Ptr (Ptr Rectangle))
    n_rectangles <- allocMem :: IO (Ptr Word32)
    result <- poppler_page_get_text_layout _obj' rectangles n_rectangles
    n_rectangles' <- peek n_rectangles
    let result' = (/= 0) result
    rectangles' <- peek rectangles
    rectangles'' <- (unpackBoxedArrayWithLength 32 n_rectangles') rectangles'
    rectangles''' <- mapM (newBoxed Rectangle) rectangles''
    freeMem rectangles'
    touchManagedPtr _obj
    freeMem rectangles
    freeMem n_rectangles
    return (result', rectangles''')

-- method Page::get_text_layout_for_area
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "area", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rectangles", argType = TCArray False (-1) 3 (TInterface "Poppler" "Rectangle"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferContainer},Arg {argName = "n_rectangles", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "n_rectangles", argType = TBasicType TUInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "area", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_text_layout_for_area" poppler_page_get_text_layout_for_area :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Rectangle ->                        -- area : TInterface "Poppler" "Rectangle"
    Ptr (Ptr Rectangle) ->                  -- rectangles : TCArray False (-1) 3 (TInterface "Poppler" "Rectangle")
    Ptr Word32 ->                           -- n_rectangles : TBasicType TUInt32
    IO CInt


pageGetTextLayoutForArea ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Rectangle ->                            -- area
    m (Bool,[Rectangle])
pageGetTextLayoutForArea _obj area = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let area' = unsafeManagedPtrGetPtr area
    rectangles <- allocMem :: IO (Ptr (Ptr Rectangle))
    n_rectangles <- allocMem :: IO (Ptr Word32)
    result <- poppler_page_get_text_layout_for_area _obj' area' rectangles n_rectangles
    n_rectangles' <- peek n_rectangles
    let result' = (/= 0) result
    rectangles' <- peek rectangles
    rectangles'' <- (unpackBoxedArrayWithLength 32 n_rectangles') rectangles'
    rectangles''' <- mapM (newBoxed Rectangle) rectangles''
    freeMem rectangles'
    touchManagedPtr _obj
    touchManagedPtr area
    freeMem rectangles
    freeMem n_rectangles
    return (result', rectangles''')

-- method Page::get_thumbnail
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Surface"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_thumbnail" poppler_page_get_thumbnail :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr Cairo.Surface)


pageGetThumbnail ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m Cairo.Surface
pageGetThumbnail _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_thumbnail _obj'
    checkUnexpectedReturnNULL "poppler_page_get_thumbnail" result
    result' <- (wrapBoxed Cairo.Surface) result
    touchManagedPtr _obj
    return result'

-- method Page::get_thumbnail_size
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_thumbnail_size" poppler_page_get_thumbnail_size :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Int32 ->                            -- width : TBasicType TInt32
    Ptr Int32 ->                            -- height : TBasicType TInt32
    IO CInt


pageGetThumbnailSize ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m (Bool,Int32,Int32)
pageGetThumbnailSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    width <- allocMem :: IO (Ptr Int32)
    height <- allocMem :: IO (Ptr Int32)
    result <- poppler_page_get_thumbnail_size _obj' width height
    let result' = (/= 0) result
    width' <- peek width
    height' <- peek height
    touchManagedPtr _obj
    freeMem width
    freeMem height
    return (result', width', height')

-- method Page::get_transition
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "PageTransition"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_get_transition" poppler_page_get_transition :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    IO (Ptr PageTransition)


pageGetTransition ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    m PageTransition
pageGetTransition _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_page_get_transition _obj'
    checkUnexpectedReturnNULL "poppler_page_get_transition" result
    result' <- (wrapBoxed PageTransition) result
    touchManagedPtr _obj
    return result'

-- method Page::remove_annot
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "annot", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "annot", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_remove_annot" poppler_page_remove_annot :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Annot ->                            -- annot : TInterface "Poppler" "Annot"
    IO ()


pageRemoveAnnot ::
    (MonadIO m, PageK a, AnnotK b) =>
    a ->                                    -- _obj
    b ->                                    -- annot
    m ()
pageRemoveAnnot _obj annot = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let annot' = unsafeManagedPtrCastPtr annot
    poppler_page_remove_annot _obj' annot'
    touchManagedPtr _obj
    touchManagedPtr annot
    return ()

-- method Page::render
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_render" poppler_page_render :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Cairo.Context ->                    -- cairo : TInterface "cairo" "Context"
    IO ()


pageRender ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Cairo.Context ->                        -- cairo
    m ()
pageRender _obj cairo = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cairo' = unsafeManagedPtrGetPtr cairo
    poppler_page_render _obj' cairo'
    touchManagedPtr _obj
    touchManagedPtr cairo
    return ()

-- method Page::render_for_printing
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_render_for_printing" poppler_page_render_for_printing :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Cairo.Context ->                    -- cairo : TInterface "cairo" "Context"
    IO ()


pageRenderForPrinting ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Cairo.Context ->                        -- cairo
    m ()
pageRenderForPrinting _obj cairo = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cairo' = unsafeManagedPtrGetPtr cairo
    poppler_page_render_for_printing _obj' cairo'
    touchManagedPtr _obj
    touchManagedPtr cairo
    return ()

-- method Page::render_for_printing_with_options
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "options", argType = TInterface "Poppler" "PrintFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "options", argType = TInterface "Poppler" "PrintFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_render_for_printing_with_options" poppler_page_render_for_printing_with_options :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Cairo.Context ->                    -- cairo : TInterface "cairo" "Context"
    CUInt ->                                -- options : TInterface "Poppler" "PrintFlags"
    IO ()


pageRenderForPrintingWithOptions ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Cairo.Context ->                        -- cairo
    [PrintFlags] ->                         -- options
    m ()
pageRenderForPrintingWithOptions _obj cairo options = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cairo' = unsafeManagedPtrGetPtr cairo
    let options' = gflagsToWord options
    poppler_page_render_for_printing_with_options _obj' cairo' options'
    touchManagedPtr _obj
    touchManagedPtr cairo
    return ()

-- method Page::render_selection
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "old_selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "glyph_color", argType = TInterface "Poppler" "Color", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "background_color", argType = TInterface "Poppler" "Color", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cairo", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "old_selection", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Poppler" "SelectionStyle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "glyph_color", argType = TInterface "Poppler" "Color", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "background_color", argType = TInterface "Poppler" "Color", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_render_selection" poppler_page_render_selection :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr Cairo.Context ->                    -- cairo : TInterface "cairo" "Context"
    Ptr Rectangle ->                        -- selection : TInterface "Poppler" "Rectangle"
    Ptr Rectangle ->                        -- old_selection : TInterface "Poppler" "Rectangle"
    CUInt ->                                -- style : TInterface "Poppler" "SelectionStyle"
    Ptr Color ->                            -- glyph_color : TInterface "Poppler" "Color"
    Ptr Color ->                            -- background_color : TInterface "Poppler" "Color"
    IO ()


pageRenderSelection ::
    (MonadIO m, PageK a) =>
    a ->                                    -- _obj
    Cairo.Context ->                        -- cairo
    Rectangle ->                            -- selection
    Rectangle ->                            -- old_selection
    SelectionStyle ->                       -- style
    Color ->                                -- glyph_color
    Color ->                                -- background_color
    m ()
pageRenderSelection _obj cairo selection old_selection style glyph_color background_color = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cairo' = unsafeManagedPtrGetPtr cairo
    let selection' = unsafeManagedPtrGetPtr selection
    let old_selection' = unsafeManagedPtrGetPtr old_selection
    let style' = (fromIntegral . fromEnum) style
    let glyph_color' = unsafeManagedPtrGetPtr glyph_color
    let background_color' = unsafeManagedPtrGetPtr background_color
    poppler_page_render_selection _obj' cairo' selection' old_selection' style' glyph_color' background_color'
    touchManagedPtr _obj
    touchManagedPtr cairo
    touchManagedPtr selection
    touchManagedPtr old_selection
    touchManagedPtr glyph_color
    touchManagedPtr background_color
    return ()

-- method Page::render_to_ps
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ps_file", argType = TInterface "Poppler" "PSFile", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Page", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ps_file", argType = TInterface "Poppler" "PSFile", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_render_to_ps" poppler_page_render_to_ps :: 
    Ptr Page ->                             -- _obj : TInterface "Poppler" "Page"
    Ptr PSFile ->                           -- ps_file : TInterface "Poppler" "PSFile"
    IO ()


pageRenderToPs ::
    (MonadIO m, PageK a, PSFileK b) =>
    a ->                                    -- _obj
    b ->                                    -- ps_file
    m ()
pageRenderToPs _obj ps_file = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let ps_file' = unsafeManagedPtrCastPtr ps_file
    poppler_page_render_to_ps _obj' ps_file'
    touchManagedPtr _obj
    touchManagedPtr ps_file
    return ()

-- method Page::free_annot_mapping
-- method type : MemberFunction
-- Args : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "AnnotMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "AnnotMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_free_annot_mapping" poppler_page_free_annot_mapping :: 
    Ptr (GList (Ptr AnnotMapping)) ->       -- list : TGList (TInterface "Poppler" "AnnotMapping")
    IO ()


pageFreeAnnotMapping ::
    (MonadIO m) =>
    [AnnotMapping] ->                       -- list
    m ()
pageFreeAnnotMapping list = liftIO $ do
    let list' = map unsafeManagedPtrGetPtr list
    list'' <- packGList list'
    poppler_page_free_annot_mapping list''
    mapM_ touchManagedPtr list
    g_list_free list''
    return ()

-- method Page::free_form_field_mapping
-- method type : MemberFunction
-- Args : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "FormFieldMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "FormFieldMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_free_form_field_mapping" poppler_page_free_form_field_mapping :: 
    Ptr (GList (Ptr FormFieldMapping)) ->   -- list : TGList (TInterface "Poppler" "FormFieldMapping")
    IO ()


pageFreeFormFieldMapping ::
    (MonadIO m) =>
    [FormFieldMapping] ->                   -- list
    m ()
pageFreeFormFieldMapping list = liftIO $ do
    let list' = map unsafeManagedPtrGetPtr list
    list'' <- packGList list'
    poppler_page_free_form_field_mapping list''
    mapM_ touchManagedPtr list
    g_list_free list''
    return ()

-- method Page::free_image_mapping
-- method type : MemberFunction
-- Args : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "ImageMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "ImageMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_free_image_mapping" poppler_page_free_image_mapping :: 
    Ptr (GList (Ptr ImageMapping)) ->       -- list : TGList (TInterface "Poppler" "ImageMapping")
    IO ()


pageFreeImageMapping ::
    (MonadIO m) =>
    [ImageMapping] ->                       -- list
    m ()
pageFreeImageMapping list = liftIO $ do
    let list' = map unsafeManagedPtrGetPtr list
    list'' <- packGList list'
    poppler_page_free_image_mapping list''
    mapM_ touchManagedPtr list
    g_list_free list''
    return ()

-- method Page::free_link_mapping
-- method type : MemberFunction
-- Args : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "LinkMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "LinkMapping"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_free_link_mapping" poppler_page_free_link_mapping :: 
    Ptr (GList (Ptr LinkMapping)) ->        -- list : TGList (TInterface "Poppler" "LinkMapping")
    IO ()


pageFreeLinkMapping ::
    (MonadIO m) =>
    [LinkMapping] ->                        -- list
    m ()
pageFreeLinkMapping list = liftIO $ do
    let list' = map unsafeManagedPtrGetPtr list
    list'' <- packGList list'
    poppler_page_free_link_mapping list''
    mapM_ touchManagedPtr list
    g_list_free list''
    return ()

-- method Page::free_text_attributes
-- method type : MemberFunction
-- Args : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "TextAttributes"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "list", argType = TGList (TInterface "Poppler" "TextAttributes"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_free_text_attributes" poppler_page_free_text_attributes :: 
    Ptr (GList (Ptr TextAttributes)) ->     -- list : TGList (TInterface "Poppler" "TextAttributes")
    IO ()


pageFreeTextAttributes ::
    (MonadIO m) =>
    [TextAttributes] ->                     -- list
    m ()
pageFreeTextAttributes list = liftIO $ do
    let list' = map unsafeManagedPtrGetPtr list
    list'' <- packGList list'
    poppler_page_free_text_attributes list''
    mapM_ touchManagedPtr list
    g_list_free list''
    return ()

-- method Page::selection_region_free
-- method type : MemberFunction
-- Args : [Arg {argName = "region", argType = TGList (TInterface "Poppler" "Rectangle"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "region", argType = TGList (TInterface "Poppler" "Rectangle"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_page_selection_region_free" poppler_page_selection_region_free :: 
    Ptr (GList (Ptr Rectangle)) ->          -- region : TGList (TInterface "Poppler" "Rectangle")
    IO ()

{-# DEPRECATED pageSelectionRegionFree ["(Since version 0.16)"]#-}
pageSelectionRegionFree ::
    (MonadIO m) =>
    [Rectangle] ->                          -- region
    m ()
pageSelectionRegionFree region = liftIO $ do
    let region' = map unsafeManagedPtrGetPtr region
    region'' <- packGList region'
    poppler_page_selection_region_free region''
    mapM_ touchManagedPtr region
    g_list_free region''
    return ()