2004-03-23 00:29:50 -05:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Name: wx.lib.pdfwin
|
|
|
|
# Purpose: A class that allows the use of the Acrobat PSF reader
|
|
|
|
# ActiveX control
|
|
|
|
#
|
|
|
|
# Author: Robin Dunn
|
|
|
|
#
|
|
|
|
# Created: 22-March-2004
|
|
|
|
# RCS-ID: $Id$
|
|
|
|
# Copyright: (c) 2004 by Total Control Software
|
|
|
|
# Licence: wxWindows license
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# This module was generated by the wx.activex.GernerateAXModule class
|
|
|
|
# (See also the genaxmodule script.)
|
|
|
|
|
|
|
|
import wx
|
|
|
|
import wx.activex
|
|
|
|
|
|
|
|
clsID = '{CA8A9780-280D-11CF-A24D-444553540000}'
|
2006-02-06 22:56:44 -05:00
|
|
|
progID = 'AcroPDF.PDF.1'
|
2004-03-23 00:29:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2006-02-06 22:56:44 -05:00
|
|
|
# Create eventTypes and event binders
|
|
|
|
wxEVT_Error = wx.activex.RegisterActiveXEvent('OnError')
|
|
|
|
wxEVT_Message = wx.activex.RegisterActiveXEvent('OnMessage')
|
|
|
|
|
|
|
|
EVT_Error = wx.PyEventBinder(wxEVT_Error, 1)
|
|
|
|
EVT_Message = wx.PyEventBinder(wxEVT_Message, 1)
|
|
|
|
|
|
|
|
|
2004-03-23 00:29:50 -05:00
|
|
|
# Derive a new class from ActiveXWindow
|
|
|
|
class PDFWindow(wx.activex.ActiveXWindow):
|
|
|
|
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
|
|
|
|
size=wx.DefaultSize, style=0, name='PDFWindow'):
|
|
|
|
wx.activex.ActiveXWindow.__init__(self, parent,
|
|
|
|
wx.activex.CLSID('{CA8A9780-280D-11CF-A24D-444553540000}'),
|
|
|
|
ID, pos, size, style, name)
|
|
|
|
|
|
|
|
# Methods exported by the ActiveX object
|
2006-02-06 22:56:44 -05:00
|
|
|
def QueryInterface(self, riid):
|
|
|
|
return self.CallAXMethod('QueryInterface', riid)
|
|
|
|
|
|
|
|
def AddRef(self):
|
|
|
|
return self.CallAXMethod('AddRef')
|
|
|
|
|
|
|
|
def Release(self):
|
|
|
|
return self.CallAXMethod('Release')
|
|
|
|
|
|
|
|
def GetTypeInfoCount(self):
|
|
|
|
return self.CallAXMethod('GetTypeInfoCount')
|
|
|
|
|
|
|
|
def GetTypeInfo(self, itinfo, lcid):
|
|
|
|
return self.CallAXMethod('GetTypeInfo', itinfo, lcid)
|
|
|
|
|
|
|
|
def GetIDsOfNames(self, riid, rgszNames, cNames, lcid):
|
|
|
|
return self.CallAXMethod('GetIDsOfNames', riid, rgszNames, cNames, lcid)
|
|
|
|
|
|
|
|
def Invoke(self, dispidMember, riid, lcid, wFlags, pdispparams):
|
|
|
|
return self.CallAXMethod('Invoke', dispidMember, riid, lcid, wFlags, pdispparams)
|
|
|
|
|
2004-03-23 00:29:50 -05:00
|
|
|
def LoadFile(self, fileName):
|
|
|
|
return self.CallAXMethod('LoadFile', fileName)
|
|
|
|
|
|
|
|
def setShowToolbar(self, On):
|
|
|
|
return self.CallAXMethod('setShowToolbar', On)
|
|
|
|
|
|
|
|
def gotoFirstPage(self):
|
|
|
|
return self.CallAXMethod('gotoFirstPage')
|
|
|
|
|
|
|
|
def gotoLastPage(self):
|
|
|
|
return self.CallAXMethod('gotoLastPage')
|
|
|
|
|
|
|
|
def gotoNextPage(self):
|
|
|
|
return self.CallAXMethod('gotoNextPage')
|
|
|
|
|
|
|
|
def gotoPreviousPage(self):
|
|
|
|
return self.CallAXMethod('gotoPreviousPage')
|
|
|
|
|
|
|
|
def setCurrentPage(self, n):
|
|
|
|
return self.CallAXMethod('setCurrentPage', n)
|
|
|
|
|
|
|
|
def goForwardStack(self):
|
|
|
|
return self.CallAXMethod('goForwardStack')
|
|
|
|
|
|
|
|
def goBackwardStack(self):
|
|
|
|
return self.CallAXMethod('goBackwardStack')
|
|
|
|
|
|
|
|
def setPageMode(self, pageMode):
|
|
|
|
return self.CallAXMethod('setPageMode', pageMode)
|
|
|
|
|
|
|
|
def setLayoutMode(self, layoutMode):
|
|
|
|
return self.CallAXMethod('setLayoutMode', layoutMode)
|
|
|
|
|
|
|
|
def setNamedDest(self, namedDest):
|
|
|
|
return self.CallAXMethod('setNamedDest', namedDest)
|
|
|
|
|
|
|
|
def Print(self):
|
|
|
|
return self.CallAXMethod('Print')
|
|
|
|
|
|
|
|
def printWithDialog(self):
|
|
|
|
return self.CallAXMethod('printWithDialog')
|
|
|
|
|
|
|
|
def setZoom(self, percent):
|
|
|
|
return self.CallAXMethod('setZoom', percent)
|
|
|
|
|
|
|
|
def setZoomScroll(self, percent, left, top):
|
|
|
|
return self.CallAXMethod('setZoomScroll', percent, left, top)
|
|
|
|
|
|
|
|
def setView(self, viewMode):
|
|
|
|
return self.CallAXMethod('setView', viewMode)
|
|
|
|
|
|
|
|
def setViewScroll(self, viewMode, offset):
|
|
|
|
return self.CallAXMethod('setViewScroll', viewMode, offset)
|
|
|
|
|
|
|
|
def setViewRect(self, left, top, width, height):
|
|
|
|
return self.CallAXMethod('setViewRect', left, top, width, height)
|
|
|
|
|
|
|
|
def printPages(self, from_, to):
|
|
|
|
return self.CallAXMethod('printPages', from_, to)
|
|
|
|
|
|
|
|
def printPagesFit(self, from_, to, shrinkToFit):
|
|
|
|
return self.CallAXMethod('printPagesFit', from_, to, shrinkToFit)
|
|
|
|
|
|
|
|
def printAll(self):
|
|
|
|
return self.CallAXMethod('printAll')
|
|
|
|
|
|
|
|
def printAllFit(self, shrinkToFit):
|
|
|
|
return self.CallAXMethod('printAllFit', shrinkToFit)
|
|
|
|
|
|
|
|
def setShowScrollbars(self, On):
|
|
|
|
return self.CallAXMethod('setShowScrollbars', On)
|
|
|
|
|
2006-02-06 22:56:44 -05:00
|
|
|
def GetVersions(self):
|
|
|
|
return self.CallAXMethod('GetVersions')
|
|
|
|
|
|
|
|
def setCurrentHightlight(self, a, b, c, d):
|
|
|
|
return self.CallAXMethod('setCurrentHightlight', a, b, c, d)
|
|
|
|
|
|
|
|
def setCurrentHighlight(self, a, b, c, d):
|
|
|
|
return self.CallAXMethod('setCurrentHighlight', a, b, c, d)
|
|
|
|
|
|
|
|
def postMessage(self, strArray):
|
|
|
|
return self.CallAXMethod('postMessage', strArray)
|
|
|
|
|
|
|
|
# Getters, Setters and properties
|
|
|
|
def _get_src(self):
|
|
|
|
return self.GetAXProp('src')
|
|
|
|
def _set_src(self, src):
|
|
|
|
self.SetAXProp('src', src)
|
|
|
|
src = property(_get_src, _set_src)
|
|
|
|
|
|
|
|
def _get_messageHandler(self):
|
|
|
|
return self.GetAXProp('messageHandler')
|
|
|
|
def _set_messageHandler(self, messageHandler):
|
|
|
|
self.SetAXProp('messageHandler', messageHandler)
|
|
|
|
messagehandler = property(_get_messageHandler, _set_messageHandler)
|
2004-03-23 00:29:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
# PROPERTIES
|
|
|
|
# --------------------
|
2006-02-06 22:56:44 -05:00
|
|
|
# src
|
|
|
|
# type:string arg:string canGet:True canSet:True
|
|
|
|
#
|
|
|
|
# messagehandler
|
|
|
|
# type:VT_VARIANT arg:VT_VARIANT canGet:True canSet:True
|
|
|
|
#
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# METHODS
|
|
|
|
# --------------------
|
2006-02-06 22:56:44 -05:00
|
|
|
# QueryInterface
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# riid
|
|
|
|
# in:True out:False optional:False type:unsupported type 29
|
|
|
|
# ppvObj
|
|
|
|
# in:False out:True optional:False type:unsupported type 26
|
|
|
|
#
|
|
|
|
# AddRef
|
|
|
|
# retType: int
|
|
|
|
#
|
|
|
|
# Release
|
|
|
|
# retType: int
|
|
|
|
#
|
|
|
|
# GetTypeInfoCount
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# pctinfo
|
|
|
|
# in:False out:True optional:False type:int
|
|
|
|
#
|
|
|
|
# GetTypeInfo
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# itinfo
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# lcid
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# pptinfo
|
|
|
|
# in:False out:True optional:False type:unsupported type 26
|
|
|
|
#
|
|
|
|
# GetIDsOfNames
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# riid
|
|
|
|
# in:True out:False optional:False type:unsupported type 29
|
|
|
|
# rgszNames
|
|
|
|
# in:True out:False optional:False type:unsupported type 26
|
|
|
|
# cNames
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# lcid
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# rgdispid
|
|
|
|
# in:False out:True optional:False type:int
|
|
|
|
#
|
|
|
|
# Invoke
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# dispidMember
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# riid
|
|
|
|
# in:True out:False optional:False type:unsupported type 29
|
|
|
|
# lcid
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# wFlags
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# pdispparams
|
|
|
|
# in:True out:False optional:False type:unsupported type 29
|
|
|
|
# pvarResult
|
|
|
|
# in:False out:True optional:False type:VT_VARIANT
|
|
|
|
# pexcepinfo
|
|
|
|
# in:False out:True optional:False type:unsupported type 29
|
|
|
|
# puArgErr
|
|
|
|
# in:False out:True optional:False type:int
|
|
|
|
#
|
2004-03-23 00:29:50 -05:00
|
|
|
# LoadFile
|
|
|
|
# retType: bool
|
|
|
|
# params:
|
|
|
|
# fileName
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:string
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setShowToolbar
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# On
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:bool
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# gotoFirstPage
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# gotoLastPage
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# gotoNextPage
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# gotoPreviousPage
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# setCurrentPage
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# n
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:int
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# goForwardStack
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# goBackwardStack
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# setPageMode
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# pageMode
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:string
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setLayoutMode
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# layoutMode
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:string
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setNamedDest
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# namedDest
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:string
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# Print
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# printWithDialog
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# setZoom
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# percent
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setZoomScroll
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# percent
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
# left
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
# top
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setView
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# viewMode
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:string
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setViewScroll
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# viewMode
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:string
|
2004-03-23 00:29:50 -05:00
|
|
|
# offset
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setViewRect
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# left
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
# top
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
# width
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
# height
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:double
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# printPages
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# from
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:int
|
2004-03-23 00:29:50 -05:00
|
|
|
# to
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:int
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# printPagesFit
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# from
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:int
|
2004-03-23 00:29:50 -05:00
|
|
|
# to
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:int
|
2004-03-23 00:29:50 -05:00
|
|
|
# shrinkToFit
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:bool
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# printAll
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# printAllFit
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# shrinkToFit
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:bool
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
# setShowScrollbars
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# On
|
2006-02-06 22:56:44 -05:00
|
|
|
# in:True out:False optional:False type:bool
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
2006-02-06 22:56:44 -05:00
|
|
|
# GetVersions
|
|
|
|
# retType: VT_VARIANT
|
|
|
|
#
|
|
|
|
# setCurrentHightlight
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# a
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# b
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# c
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# d
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
#
|
|
|
|
# setCurrentHighlight
|
|
|
|
# retType: VT_VOID
|
|
|
|
# params:
|
|
|
|
# a
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# b
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# c
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
# d
|
|
|
|
# in:True out:False optional:False type:int
|
|
|
|
#
|
|
|
|
# postMessage
|
2004-03-23 00:29:50 -05:00
|
|
|
# retType: VT_VOID
|
2006-02-06 22:56:44 -05:00
|
|
|
# params:
|
|
|
|
# strArray
|
|
|
|
# in:True out:False optional:False type:VT_VARIANT
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# EVENTS
|
|
|
|
# --------------------
|
2006-02-06 22:56:44 -05:00
|
|
|
# Error
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
|
|
|
# Message
|
|
|
|
# retType: VT_VOID
|
|
|
|
#
|
2004-03-23 00:29:50 -05:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|