| 1 | #---------------------------------------------------------------------- |
| 2 | # Name: wx.lib.pdfwin |
| 3 | # Purpose: A class that allows the use of the Acrobat PSF reader |
| 4 | # ActiveX control |
| 5 | # |
| 6 | # Author: Robin Dunn |
| 7 | # |
| 8 | # Created: 22-March-2004 |
| 9 | # RCS-ID: $Id$ |
| 10 | # Copyright: (c) 2004 by Total Control Software |
| 11 | # Licence: wxWindows license |
| 12 | #---------------------------------------------------------------------- |
| 13 | # This module was generated by the wx.activex.GernerateAXModule class |
| 14 | # (See also the genaxmodule script.) |
| 15 | |
| 16 | import wx |
| 17 | import wx.activex |
| 18 | |
| 19 | clsID = '{CA8A9780-280D-11CF-A24D-444553540000}' |
| 20 | progID = 'AcroPDF.PDF.1' |
| 21 | |
| 22 | |
| 23 | |
| 24 | # Create eventTypes and event binders |
| 25 | wxEVT_Error = wx.activex.RegisterActiveXEvent('OnError') |
| 26 | wxEVT_Message = wx.activex.RegisterActiveXEvent('OnMessage') |
| 27 | |
| 28 | EVT_Error = wx.PyEventBinder(wxEVT_Error, 1) |
| 29 | EVT_Message = wx.PyEventBinder(wxEVT_Message, 1) |
| 30 | |
| 31 | |
| 32 | # Derive a new class from ActiveXWindow |
| 33 | class PDFWindow(wx.activex.ActiveXWindow): |
| 34 | def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, |
| 35 | size=wx.DefaultSize, style=0, name='PDFWindow'): |
| 36 | wx.activex.ActiveXWindow.__init__(self, parent, |
| 37 | wx.activex.CLSID('{CA8A9780-280D-11CF-A24D-444553540000}'), |
| 38 | ID, pos, size, style, name) |
| 39 | |
| 40 | # Methods exported by the ActiveX object |
| 41 | def QueryInterface(self, riid): |
| 42 | return self.CallAXMethod('QueryInterface', riid) |
| 43 | |
| 44 | def AddRef(self): |
| 45 | return self.CallAXMethod('AddRef') |
| 46 | |
| 47 | def Release(self): |
| 48 | return self.CallAXMethod('Release') |
| 49 | |
| 50 | def GetTypeInfoCount(self): |
| 51 | return self.CallAXMethod('GetTypeInfoCount') |
| 52 | |
| 53 | def GetTypeInfo(self, itinfo, lcid): |
| 54 | return self.CallAXMethod('GetTypeInfo', itinfo, lcid) |
| 55 | |
| 56 | def GetIDsOfNames(self, riid, rgszNames, cNames, lcid): |
| 57 | return self.CallAXMethod('GetIDsOfNames', riid, rgszNames, cNames, lcid) |
| 58 | |
| 59 | def Invoke(self, dispidMember, riid, lcid, wFlags, pdispparams): |
| 60 | return self.CallAXMethod('Invoke', dispidMember, riid, lcid, wFlags, pdispparams) |
| 61 | |
| 62 | def LoadFile(self, fileName): |
| 63 | return self.CallAXMethod('LoadFile', fileName) |
| 64 | |
| 65 | def setShowToolbar(self, On): |
| 66 | return self.CallAXMethod('setShowToolbar', On) |
| 67 | |
| 68 | def gotoFirstPage(self): |
| 69 | return self.CallAXMethod('gotoFirstPage') |
| 70 | |
| 71 | def gotoLastPage(self): |
| 72 | return self.CallAXMethod('gotoLastPage') |
| 73 | |
| 74 | def gotoNextPage(self): |
| 75 | return self.CallAXMethod('gotoNextPage') |
| 76 | |
| 77 | def gotoPreviousPage(self): |
| 78 | return self.CallAXMethod('gotoPreviousPage') |
| 79 | |
| 80 | def setCurrentPage(self, n): |
| 81 | return self.CallAXMethod('setCurrentPage', n) |
| 82 | |
| 83 | def goForwardStack(self): |
| 84 | return self.CallAXMethod('goForwardStack') |
| 85 | |
| 86 | def goBackwardStack(self): |
| 87 | return self.CallAXMethod('goBackwardStack') |
| 88 | |
| 89 | def setPageMode(self, pageMode): |
| 90 | return self.CallAXMethod('setPageMode', pageMode) |
| 91 | |
| 92 | def setLayoutMode(self, layoutMode): |
| 93 | return self.CallAXMethod('setLayoutMode', layoutMode) |
| 94 | |
| 95 | def setNamedDest(self, namedDest): |
| 96 | return self.CallAXMethod('setNamedDest', namedDest) |
| 97 | |
| 98 | def Print(self): |
| 99 | return self.CallAXMethod('Print') |
| 100 | |
| 101 | def printWithDialog(self): |
| 102 | return self.CallAXMethod('printWithDialog') |
| 103 | |
| 104 | def setZoom(self, percent): |
| 105 | return self.CallAXMethod('setZoom', percent) |
| 106 | |
| 107 | def setZoomScroll(self, percent, left, top): |
| 108 | return self.CallAXMethod('setZoomScroll', percent, left, top) |
| 109 | |
| 110 | def setView(self, viewMode): |
| 111 | return self.CallAXMethod('setView', viewMode) |
| 112 | |
| 113 | def setViewScroll(self, viewMode, offset): |
| 114 | return self.CallAXMethod('setViewScroll', viewMode, offset) |
| 115 | |
| 116 | def setViewRect(self, left, top, width, height): |
| 117 | return self.CallAXMethod('setViewRect', left, top, width, height) |
| 118 | |
| 119 | def printPages(self, from_, to): |
| 120 | return self.CallAXMethod('printPages', from_, to) |
| 121 | |
| 122 | def printPagesFit(self, from_, to, shrinkToFit): |
| 123 | return self.CallAXMethod('printPagesFit', from_, to, shrinkToFit) |
| 124 | |
| 125 | def printAll(self): |
| 126 | return self.CallAXMethod('printAll') |
| 127 | |
| 128 | def printAllFit(self, shrinkToFit): |
| 129 | return self.CallAXMethod('printAllFit', shrinkToFit) |
| 130 | |
| 131 | def setShowScrollbars(self, On): |
| 132 | return self.CallAXMethod('setShowScrollbars', On) |
| 133 | |
| 134 | def GetVersions(self): |
| 135 | return self.CallAXMethod('GetVersions') |
| 136 | |
| 137 | def setCurrentHightlight(self, a, b, c, d): |
| 138 | return self.CallAXMethod('setCurrentHightlight', a, b, c, d) |
| 139 | |
| 140 | def setCurrentHighlight(self, a, b, c, d): |
| 141 | return self.CallAXMethod('setCurrentHighlight', a, b, c, d) |
| 142 | |
| 143 | def postMessage(self, strArray): |
| 144 | return self.CallAXMethod('postMessage', strArray) |
| 145 | |
| 146 | # Getters, Setters and properties |
| 147 | def _get_src(self): |
| 148 | return self.GetAXProp('src') |
| 149 | def _set_src(self, src): |
| 150 | self.SetAXProp('src', src) |
| 151 | src = property(_get_src, _set_src) |
| 152 | |
| 153 | def _get_messageHandler(self): |
| 154 | return self.GetAXProp('messageHandler') |
| 155 | def _set_messageHandler(self, messageHandler): |
| 156 | self.SetAXProp('messageHandler', messageHandler) |
| 157 | messagehandler = property(_get_messageHandler, _set_messageHandler) |
| 158 | |
| 159 | |
| 160 | # PROPERTIES |
| 161 | # -------------------- |
| 162 | # src |
| 163 | # type:string arg:string canGet:True canSet:True |
| 164 | # |
| 165 | # messagehandler |
| 166 | # type:VT_VARIANT arg:VT_VARIANT canGet:True canSet:True |
| 167 | # |
| 168 | # |
| 169 | # |
| 170 | # |
| 171 | # METHODS |
| 172 | # -------------------- |
| 173 | # QueryInterface |
| 174 | # retType: VT_VOID |
| 175 | # params: |
| 176 | # riid |
| 177 | # in:True out:False optional:False type:unsupported type 29 |
| 178 | # ppvObj |
| 179 | # in:False out:True optional:False type:unsupported type 26 |
| 180 | # |
| 181 | # AddRef |
| 182 | # retType: int |
| 183 | # |
| 184 | # Release |
| 185 | # retType: int |
| 186 | # |
| 187 | # GetTypeInfoCount |
| 188 | # retType: VT_VOID |
| 189 | # params: |
| 190 | # pctinfo |
| 191 | # in:False out:True optional:False type:int |
| 192 | # |
| 193 | # GetTypeInfo |
| 194 | # retType: VT_VOID |
| 195 | # params: |
| 196 | # itinfo |
| 197 | # in:True out:False optional:False type:int |
| 198 | # lcid |
| 199 | # in:True out:False optional:False type:int |
| 200 | # pptinfo |
| 201 | # in:False out:True optional:False type:unsupported type 26 |
| 202 | # |
| 203 | # GetIDsOfNames |
| 204 | # retType: VT_VOID |
| 205 | # params: |
| 206 | # riid |
| 207 | # in:True out:False optional:False type:unsupported type 29 |
| 208 | # rgszNames |
| 209 | # in:True out:False optional:False type:unsupported type 26 |
| 210 | # cNames |
| 211 | # in:True out:False optional:False type:int |
| 212 | # lcid |
| 213 | # in:True out:False optional:False type:int |
| 214 | # rgdispid |
| 215 | # in:False out:True optional:False type:int |
| 216 | # |
| 217 | # Invoke |
| 218 | # retType: VT_VOID |
| 219 | # params: |
| 220 | # dispidMember |
| 221 | # in:True out:False optional:False type:int |
| 222 | # riid |
| 223 | # in:True out:False optional:False type:unsupported type 29 |
| 224 | # lcid |
| 225 | # in:True out:False optional:False type:int |
| 226 | # wFlags |
| 227 | # in:True out:False optional:False type:int |
| 228 | # pdispparams |
| 229 | # in:True out:False optional:False type:unsupported type 29 |
| 230 | # pvarResult |
| 231 | # in:False out:True optional:False type:VT_VARIANT |
| 232 | # pexcepinfo |
| 233 | # in:False out:True optional:False type:unsupported type 29 |
| 234 | # puArgErr |
| 235 | # in:False out:True optional:False type:int |
| 236 | # |
| 237 | # LoadFile |
| 238 | # retType: bool |
| 239 | # params: |
| 240 | # fileName |
| 241 | # in:True out:False optional:False type:string |
| 242 | # |
| 243 | # setShowToolbar |
| 244 | # retType: VT_VOID |
| 245 | # params: |
| 246 | # On |
| 247 | # in:True out:False optional:False type:bool |
| 248 | # |
| 249 | # gotoFirstPage |
| 250 | # retType: VT_VOID |
| 251 | # |
| 252 | # gotoLastPage |
| 253 | # retType: VT_VOID |
| 254 | # |
| 255 | # gotoNextPage |
| 256 | # retType: VT_VOID |
| 257 | # |
| 258 | # gotoPreviousPage |
| 259 | # retType: VT_VOID |
| 260 | # |
| 261 | # setCurrentPage |
| 262 | # retType: VT_VOID |
| 263 | # params: |
| 264 | # n |
| 265 | # in:True out:False optional:False type:int |
| 266 | # |
| 267 | # goForwardStack |
| 268 | # retType: VT_VOID |
| 269 | # |
| 270 | # goBackwardStack |
| 271 | # retType: VT_VOID |
| 272 | # |
| 273 | # setPageMode |
| 274 | # retType: VT_VOID |
| 275 | # params: |
| 276 | # pageMode |
| 277 | # in:True out:False optional:False type:string |
| 278 | # |
| 279 | # setLayoutMode |
| 280 | # retType: VT_VOID |
| 281 | # params: |
| 282 | # layoutMode |
| 283 | # in:True out:False optional:False type:string |
| 284 | # |
| 285 | # setNamedDest |
| 286 | # retType: VT_VOID |
| 287 | # params: |
| 288 | # namedDest |
| 289 | # in:True out:False optional:False type:string |
| 290 | # |
| 291 | # Print |
| 292 | # retType: VT_VOID |
| 293 | # |
| 294 | # printWithDialog |
| 295 | # retType: VT_VOID |
| 296 | # |
| 297 | # setZoom |
| 298 | # retType: VT_VOID |
| 299 | # params: |
| 300 | # percent |
| 301 | # in:True out:False optional:False type:double |
| 302 | # |
| 303 | # setZoomScroll |
| 304 | # retType: VT_VOID |
| 305 | # params: |
| 306 | # percent |
| 307 | # in:True out:False optional:False type:double |
| 308 | # left |
| 309 | # in:True out:False optional:False type:double |
| 310 | # top |
| 311 | # in:True out:False optional:False type:double |
| 312 | # |
| 313 | # setView |
| 314 | # retType: VT_VOID |
| 315 | # params: |
| 316 | # viewMode |
| 317 | # in:True out:False optional:False type:string |
| 318 | # |
| 319 | # setViewScroll |
| 320 | # retType: VT_VOID |
| 321 | # params: |
| 322 | # viewMode |
| 323 | # in:True out:False optional:False type:string |
| 324 | # offset |
| 325 | # in:True out:False optional:False type:double |
| 326 | # |
| 327 | # setViewRect |
| 328 | # retType: VT_VOID |
| 329 | # params: |
| 330 | # left |
| 331 | # in:True out:False optional:False type:double |
| 332 | # top |
| 333 | # in:True out:False optional:False type:double |
| 334 | # width |
| 335 | # in:True out:False optional:False type:double |
| 336 | # height |
| 337 | # in:True out:False optional:False type:double |
| 338 | # |
| 339 | # printPages |
| 340 | # retType: VT_VOID |
| 341 | # params: |
| 342 | # from |
| 343 | # in:True out:False optional:False type:int |
| 344 | # to |
| 345 | # in:True out:False optional:False type:int |
| 346 | # |
| 347 | # printPagesFit |
| 348 | # retType: VT_VOID |
| 349 | # params: |
| 350 | # from |
| 351 | # in:True out:False optional:False type:int |
| 352 | # to |
| 353 | # in:True out:False optional:False type:int |
| 354 | # shrinkToFit |
| 355 | # in:True out:False optional:False type:bool |
| 356 | # |
| 357 | # printAll |
| 358 | # retType: VT_VOID |
| 359 | # |
| 360 | # printAllFit |
| 361 | # retType: VT_VOID |
| 362 | # params: |
| 363 | # shrinkToFit |
| 364 | # in:True out:False optional:False type:bool |
| 365 | # |
| 366 | # setShowScrollbars |
| 367 | # retType: VT_VOID |
| 368 | # params: |
| 369 | # On |
| 370 | # in:True out:False optional:False type:bool |
| 371 | # |
| 372 | # GetVersions |
| 373 | # retType: VT_VARIANT |
| 374 | # |
| 375 | # setCurrentHightlight |
| 376 | # retType: VT_VOID |
| 377 | # params: |
| 378 | # a |
| 379 | # in:True out:False optional:False type:int |
| 380 | # b |
| 381 | # in:True out:False optional:False type:int |
| 382 | # c |
| 383 | # in:True out:False optional:False type:int |
| 384 | # d |
| 385 | # in:True out:False optional:False type:int |
| 386 | # |
| 387 | # setCurrentHighlight |
| 388 | # retType: VT_VOID |
| 389 | # params: |
| 390 | # a |
| 391 | # in:True out:False optional:False type:int |
| 392 | # b |
| 393 | # in:True out:False optional:False type:int |
| 394 | # c |
| 395 | # in:True out:False optional:False type:int |
| 396 | # d |
| 397 | # in:True out:False optional:False type:int |
| 398 | # |
| 399 | # postMessage |
| 400 | # retType: VT_VOID |
| 401 | # params: |
| 402 | # strArray |
| 403 | # in:True out:False optional:False type:VT_VARIANT |
| 404 | # |
| 405 | # |
| 406 | # |
| 407 | # |
| 408 | # EVENTS |
| 409 | # -------------------- |
| 410 | # Error |
| 411 | # retType: VT_VOID |
| 412 | # |
| 413 | # Message |
| 414 | # retType: VT_VOID |
| 415 | # |
| 416 | # |
| 417 | # |
| 418 | # |