:Start of VDSAcroPDF VDSAcroPDF.dsc
DragonSphereSoftware

DragonSphere Software Demos


If you are viewing this script in your browser you can save it as a VDS 5.x source file (*.dsc) to run it.





Title Embeded PDF Example
#
# DragonSphere Software's Home Page
#  
# All Source Files for this demo
#
# This demo hosts the Adobe Reader 7.0 in a VDS dialog.
# The example uses the IAcroAXDocShim Interface and shows how
# to create the AcroPDFLib object and place it on a VDS Dialog
# 

If @Greater(@Name(@SYSINFO(DSVER)),4)

External GadgetX.dll,@SYSINFO(DSVER)

  # GadgetX Commands
  #DEFINE COMMAND,GadgetX,OLE,Set
  # GadgetX Functions
  #DEFINE FUNCTION,GadgetX,OLE,Get
Else
  Warn This demo was designed to work with@CR()VDS 5.x from http://www.dialogscript.com
  Stop
End

# The following line is required
Ole Init
# The following line is optional
# it is here for debugging your script
# Ole Exceptions,SHOW

DIALOG CREATE,Embeded PDF Example,-1,0,276,110
REM *** Modified by Dialog Designer on 12/2/2005 - 10:10 ***
  DIALOG ADD,TEXT,TEXT1,21,10,,,Click the Select but for the PDF file you want to view.
  DIALOG ADD,BUTTON,PDFCLICK,56,101,64,24,Select
DIALOG SHOWMODAL

:evloop
  wait event
  %E = @event()
  if %E
    goto %E
  End
goto evloop

:PDFCLICKBUTTON
  # IAcroAXDocShim Interface
  # Example:  Uses the following inline command to add
  #           and create the control with a single command.
  %%classname = #PDFExample  
  DIALOG CREATE,PDF,-1,0,800,600,CLASS PDFExample
  DIALOG Add,MENU,&File,&Open,-,&Quit
    # Add the Acrobat PDF reader ActiveX control
    GadgetX Add,Ole,AcroPDFLib,%%classname,0,0,800,600,AcroPDF.PDF.1
  DIALOG SHOW
:OPENMENU
  %F = @filedlg("PDF file (*.pdf)|*.pdf",Open file)
  If %F
    If @Get(AcroPDFLib)
      # property src
      Ole Set,AcroPDFLib,"src = ^B",@Path(%F)
      # method LoadFile
      #%A = @Ole(Call,AcroPDFLib,^B,"LoadFile(^B)",@Name(%F).@Ext(%F))
      Ole Call,AcroPDFLib,"LoadFile(^B)",@Name(%F).@Ext(%F)
      # method printWithDialog
      Ole Call,AcroPDFLib,printWithDialog
    End
  End
goto evloop

:QUITMENU
:CLOSE
  # The lines below are required to be called
  # before your script exits
  If @Get(AcroPDFLib)
    # Remove the object from the Dialog
    Ole Remove,AcroPDFLib,%%classname
    # Free the Object variable
    Ole Free,Object,AcroPDFLib
  End
  # Close the dialogs for this example
  DIALOG SELECT,1
  DIALOG CLOSE
  DIALOG SELECT,0
  DIALOG CLOSE
  # The following line is optional
  # it is here for debugging your script
  # Ole Exceptions,HIDE
  
  # The following line is required to be
  # the very last executed line in your script
  Ole UnInit
Exit
:End of VDSAcroPDF