Page 1 of 1

How to use PDF files as control with PureDispHelper

Posted: Sat Mar 22, 2008 8:23 pm
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

Posted: Thu Mar 27, 2008 4:42 am
by byo
Yes, AcroPDF is small and good. :)