How to use PDF files as control with PureDispHelper

Share your advanced PureBasic knowledge/code with the community.
User avatar
Stefan Schnell
User
User
Posts: 85
Joined: Wed May 07, 2003 2:53 pm
Location: Germany - Oberirsen
Contact:

How to use PDF files as control with PureDispHelper

Post by Stefan Schnell »

Hello community,
the results of my experiments of my question http://www.purebasic.fr/english/viewtopic.php?t=31559 here, for everybody who want to use a PDF files in a PB program with PureDispHelper:

Code: Select all

; Begin-----------------------------------------------------------------

  XIncludeFile "DispHelper_Include.pbi"

  EnableExplicit

  ; Main----------------------------------------------------------------

    Define oAcro.l

    If OpenWindow(0, 0, 0, 640, 480, "Acrobat")
      If CreateGadgetList(WindowID(0))

        ContainerGadget(1, 10, 10, 620, 460, #PB_Container_Double)

        dhInitializeImp()

        oAcro = dhCreateObject("AcroPDF.PDF.1", GadgetID(1))

        If oAcro

          dhPutValue(oAcro, "src = %B", StringToBSTR("file://C:\\Dummy\\README-EN.pdf"))
          dhCallMethod(oAcro, "setShowToolbar(%b)", #False)
          dhCallMethod(oAcro, "setView(%B)", StringToBSTR("FitH"))
          dhCallMethod(oAcro, "setPageMode(%B)", StringToBSTR("none"))
          dhCallMethod(oAcro, "setLayoutMode(%B)", StringToBSTR("SinglePage"))

        EndIf

      EndIf

      While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend

      If oAcro
        dhReleaseObject(oAcro) : oAcro = 0
      EndIf

      CloseWindow(0)

    EndIf


; End-------------------------------------------------------------------
End
A complete list of the possible PDF commands and arguments you find here:
http://www.adobe.com/devnet/acrobat/int ... ation.html.
The PureDispHelp you find here:
http://www.purearea.net/pb/showcase/show.php?id=413, great module :D , thanks Thomas.
Cheers
Stefan
byo
Enthusiast
Enthusiast
Posts: 635
Joined: Mon Apr 02, 2007 1:43 am
Location: Brazil

Post by byo »

Yes, AcroPDF is small and good. :)
Proud registered Purebasic user.
Because programming should be fun.
Post Reply