- Mariano Recuero
- PowerBuilder
- Wednesday, 18 April 2018 10:34 AM UTC
Hi,
I have created a webservice from PB 12.5 Classic.
Webservice got a function that receive some parameters, retrieve data from DB in a datastore and then save ds as a pdf file (in C:\temp\PDFs\) and then return name and path of file created.
From Asp.Net MVC i call webservice and then i receive path and name of new file.
Problem is that everything works fine but save ds as pdf file.
I got installed GS and a printer for creating PDF
Any idea about this error and solution?
This is the code in NVO (always return ERROR_-2):
dataStore ldst_report
string ls_dataobject, ls_filename, ls_path, ls_filenameguid
long ll_rows, ll_returnthis.of_populatedbparm (as_server, as_database, as_user, as_password)
if not SQLCA.of_isconnected( ) Then
IF SQLCA.of_connect( ) = -1 Then
as_filename = "ERROR_-1 "
Return
end if
end ifls_filenameguid = as_filename
as_filename = "ERROR_0"
ls_dataobject = as_report + "_" + as_language
ldst_report = CREATE dataStore
ldst_report.dataObject = ls_dataobject
ldst_report.SetTransObject(SQLCA)
ll_rows = ldst_report.Retrieve(al_centroid, as_sqlwhere, as_userid, as_rolename, as_applicationname, as_sqldateformat)
al_rows = ll_rows0 Then
ls_path = "C:\temp\PDFs\"
ls_filename = ls_filenameguid + ".pdf"
ls_path = ls_path + ls_filename
ldst_report.Object.DataWindow.Export.PDF.Method = Distill!
ldst_report.Object.DataWindow.Printer = "Sybase DataWindow PS"
ldst_report.Object.DataWindow.Export.PDF.Distill.CustomPostScript="No"
ll_return = ldst_report.SaveAs(ls_path, PDF!, TRUE)
as_filename = ls_filename
if (ll_return 1) Then as_filename = "ERROR_-2 " + ls_path
End IfDESTROY ldst_report
SQLCA.of_disconnect( )
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.