Window procedure (with PDF previewer)

<< Click to Display Table of Contents >>

Navigation:  EasyPDFMaker documentation > Getting started > Step by Step > Working with PDF file > Conceptual examples >

Window procedure (with PDF previewer)

Previous pageReturn to chapter overviewNext page

!!! Generated from procedure template - Source

MainSrcWin           PROCEDURE                             ! Declare Procedure

Window                 WINDOW('Caption'),AT(,,533,351),FONT('Microsoft Sans Serif',8),CENTER,GRAY,SYSTEM

                        REGION,AT(14,14,495,309),USE(?rgnHtml)

                      END

 

pdfMaker               CLASS(TPDFMake)

Load                     PROCEDURE(STRING pHtmlFile), DERIVED

Run                       PROCEDURE()

                      END

 

pdfViewer               EasyHtmlEditor

 

 CODE

 OPEN(Window)

 

 !- init viewer

 pdfViewer.InitControl(Window, ?rgnHtml)

 pdfViewer.ReadOnly(TRUE)

 pdfViewer.ToolbarVisible(FALSE)

 

 !- load script

 pdfMaker.Load('.\PdfMake\EasyPDFMaker.html')

 

 ACCEPT

   IF EVENT() = EVENT:OpenWindow

    !- create pdf

    pdfMaker.Run()

  END

 END

 pdfViewer.KillControl()

 

!- pdfMaker methods

pdfMaker.Load                 PROCEDURE(STRING pHtmlFile)

 CODE

 SELF.SetViewer(pdfViewer, -1, -1)

 PARENT.Load(pHtmlFile)

 

pdfMaker.Run                 PROCEDURE()

dd                             TDocDefinition

 CODE

 !- Build DocDefinition object

 dd.BeginContent()

 dd.AddText('Hello world!')

 dd.EndContent()

 

 !- set pdf file name

 SELF.pdfFile = 'test.pdf'

 

 !- Invoke "fnGetPDF" script, passing DocDefinition object as an argument

 PARENT.Run('fnGetPDF', dd)