$PBExportHeader$w_main.srw forward global type w_main from window end type type cb_properties from commandbutton within w_main end type type cb_split from commandbutton within w_main end type type st_msg from statictext within w_main end type type cb_save from commandbutton within w_main end type type dw_customer from datawindow within w_main end type type cb_cancel from commandbutton within w_main end type end forward global type w_main from window integer width = 3561 integer height = 2548 boolean titlebar = true string title = "Amyuni PDF Converter Demo" boolean controlmenu = true boolean minbox = true boolean maxbox = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_properties cb_properties cb_split cb_split st_msg st_msg cb_save cb_save dw_customer dw_customer cb_cancel cb_cancel end type global w_main w_main type prototypes Function boolean QueryPerformanceFrequency ( & Ref Double lpFrequency & ) Library "kernel32.dll" Function boolean QueryPerformanceCounter ( & Ref Double lpPerformanceCount & ) Library "kernel32.dll" end prototypes type variables n_cst_amyuni_pdf in_pdf Double idbl_frequency = 0 end variables forward prototypes public function double wf_perfstart () public function double wf_perfstop (double adbl_start) end prototypes public function double wf_perfstart ();Double ldbl_start If idbl_frequency = 0 Then QueryPerformanceFrequency(idbl_frequency) End If QueryPerformanceCounter(ldbl_start) Return ldbl_start end function public function double wf_perfstop (double adbl_start);Double ldbl_stop, ldbl_elapsed QueryPerformanceCounter(ldbl_stop) If idbl_frequency > 0 Then ldbl_elapsed = (ldbl_stop - adbl_start) / idbl_frequency End If Return ldbl_elapsed end function on w_main.create this.cb_properties=create cb_properties this.cb_split=create cb_split this.st_msg=create st_msg this.cb_save=create cb_save this.dw_customer=create dw_customer this.cb_cancel=create cb_cancel this.Control[]={this.cb_properties,& this.cb_split,& this.st_msg,& this.cb_save,& this.dw_customer,& this.cb_cancel} end on on w_main.destroy destroy(this.cb_properties) destroy(this.cb_split) destroy(this.st_msg) destroy(this.cb_save) destroy(this.dw_customer) destroy(this.cb_cancel) end on event open;If in_pdf.of_Installed() Then dw_customer.Retrieve() Else MessageBox(this.title, "The Amyuni PDF printer is not installed!", StopSign!) End If end event type cb_properties from commandbutton within w_main integer x = 1024 integer y = 64 integer width = 407 integer height = 132 integer taborder = 10 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Properties" end type event clicked;Integer li_rc String ls_title, ls_filter, ls_pathname, ls_filename ls_title = "Select a PDF" ls_filter = "PDF Files (*.pdf),*.pdf" li_rc = GetFileOpenName(ls_title, ls_pathname, ls_filename, "pdf", ls_filter) If li_rc = 1 Then If in_pdf.of_DocOpen(ls_pathname) Then in_pdf.of_DocSetTitle("Test Document") in_pdf.of_DocSetAuthor("Roland Smith") in_pdf.of_DocSetSubject("DataWindow Report") in_pdf.of_DocSetKeywords("DataWindow, PowerBuilder") in_pdf.of_DocSave(ls_pathname) in_pdf.of_DocClose() End If End If end event type cb_split from commandbutton within w_main integer x = 549 integer y = 64 integer width = 407 integer height = 132 integer taborder = 50 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Split PDF" end type event clicked;Boolean lb_Result Double ldbl_start, ldbl_elapsed Integer li_rc String ls_title, ls_filter, ls_OutputFile, ls_filename ls_title = "Select a PDF" ls_filter = "PDF Files (*.pdf),*.pdf" li_rc = GetFileOpenName(ls_title, ls_OutputFile, ls_filename, "pdf", ls_filter) If li_rc = 1 Then ldbl_start = wf_PerfStart() If in_pdf.of_DocOpen(ls_OutputFile) Then lb_Result = in_pdf.of_DocSplit(ls_OutputFile) in_pdf.of_DocClose() ldbl_elapsed = wf_PerfStop(ldbl_start) If lb_Result Then st_msg.text = this.text + " elapsed time: " + & String(ldbl_elapsed, "#,##0.0000") + " seconds" Else MessageBox("Split PDF Error", & "Function: " + in_pdf.ErrorFunction + "~r~n" + & "Message: " + in_pdf.ErrorMessage, StopSign!) End If End If End If end event type st_msg from statictext within w_main integer x = 73 integer y = 2320 integer width = 3003 integer height = 68 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 boolean focusrectangle = false end type type cb_save from commandbutton within w_main integer x = 73 integer y = 64 integer width = 407 integer height = 132 integer taborder = 10 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Save to PDF" end type event clicked;Boolean lb_Result Double ldbl_start, ldbl_elapsed String ls_ErrorMsg, ls_OutputFile SetPointer(HourGlass!) If Not in_pdf.of_Installed() Then MessageBox(this.text, & "The Amyuni printer is not installed!", StopSign!) Return End If st_msg.text = "" ls_OutputFile = GetCurrentDirectory() + "\AmyuniTest.pdf" FileDelete(ls_OutputFile) ldbl_start = wf_PerfStart() // set a watermark in_pdf.of_SetWatermark("Sample Watermark", & "Tahoma", 36, -450, 32768, & 300, -300, False) // save the DataWindow to a PDF file lb_Result = in_pdf.of_SaveToPDF(dw_customer, ls_OutputFile) ldbl_elapsed = wf_PerfStop(ldbl_start) If lb_Result Then st_msg.text = this.text + " elapsed time: " + & String(ldbl_elapsed, "#,##0.0000") + " seconds" Else MessageBox("Save To PDF Error", & "Function: " + in_pdf.ErrorFunction + "~r~n" + & "Message: " + in_pdf.ErrorMessage, StopSign!) End If SetPointer(Arrow!) end event type dw_customer from datawindow within w_main integer x = 73 integer y = 256 integer width = 3406 integer height = 1988 integer taborder = 60 string title = "none" string dataobject = "d_customer" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event constructor;this.SetTransObject(sqlca) end event event rowfocuschanged;this.SelectRow(0, False) this.SelectRow(currentrow, True) end event type cb_cancel from commandbutton within w_main integer x = 3145 integer y = 2304 integer width = 334 integer height = 100 integer taborder = 70 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Cancel" boolean cancel = true end type event clicked;Close(Parent) end event
File: w_main.srw
Size: 7309
Date: Mon, 31 Dec 2018 21:14:38 +0100
Size: 7309
Date: Mon, 31 Dec 2018 21:14:38 +0100
- window w_main(srw)
- commandbutton cb_properties
- commandbutton cb_split
- statictext st_msg
- commandbutton cb_save
- datawindow dw_customer
- commandbutton cb_cancel