Hello,
PB 2022 B 2819, Application run as a Windows Service
When the control hits the command PrintGetPrinter(), it seems the application re-starts from the beginning. In my windows service application, I need to set the printer to another printer (CutePDF), print a report, switch back to original printer.
On execution, the control didn't go beyond the command PrintGetPrinter() command. Full code is
ls_current_printer = PrintGetPrinter()
ls_pdf_printer = 'CutePDF Writer'
ls_result = tab_1.tabpage_2.dw_report.Modify("Datawindow.Export.PDF.Method = Distill!")
ls_result = tab_1.tabpage_2.dw_report.Modify("DataWindow.Print.PrinterName = '" + ls_pdf_printer + "'")
ls_result = tab_1.tabpage_2.dw_report.Modify("Datawindow.Export.PDF.Distill.CustomPostScript = Yes")
"Yes"
// write to the file
ll_ret = tab_1.tabpage_2.dw_report.SaveAs(ls_filename, PDF!, True)
If ll_ret <> 1 Then
MessageBox('Elifa', 'Some error occurred while saving the File. Try Again. If problem persists contact Elite Computers Inc.')
Return ''
End If
ls_result = tab_1.tabpage_2.dw_report.Modify("DataWindow.Print.PrinterName = '" + ls_current_printer + "'")
ls_result = tab_1.tabpage_2.dw_report.Modify("Datawindow.Export.PDF.Distill.CustomPostScript = 0")
ll_ret = PrintSetPrinter(ls_current_printer)
Both commands, PrintGetPrinter and PrintSetPrinter fails to execute in windows service program. That works find when run from the powerbuilder ide as a normal windows application.
Is that normal behavior?
If Yes, is there any other way that I can print a report to a pdf file? [ NativePDF fails when there are UNICODE contents. Bug no. 10700 ]
Happiness Always
BKR Sivaprakash
Yes, I use NativePDF , if there no no unicode contents in the report. It works fine.
CutePDF installs Ghostscript for its processing, [ from my memory ] and we don't re-install ghostscript again. It works fine when run as a windows application.
We have used Roland's PBNiServ with great success, but we do not try and print from this.