I saw the recent post importdatawindow-returning-1-for-sp-datasource, and have been having a similar issue.
PDFdocument lpdf_doc
lpdf_doc = create PDFdocument
.....
.......
dw_1.settransobject( sqlca )
dw_1.retrieve( report_number )
dw_1.object.DataWindow.Export.PDF.Method = NativePDF!
dw_1.Object.DataWindow.Export.PDF.NativePDF.PDFStandard ='1'
dw_1.Object.DataWindow.Export.PDF.NativePDF.CustomSize = '5'
ll_return = lpdf_doc.importdatawindow( dw_1 )
[THIS IS THE CALL THAT THROWS THE ERROR]
We have had a user experiencing this issue for some time now.
The previous code used a simple dw_1.SaveAs ( ls_network_path, PDF!, TRUE) with no issues.
Prior to switching over to using PDFDocument, I had published a question regarding if GhostScript was still required if we were switching over to using PDFDocment. I believe the response was that one didn't necessarily have anything to do with the other.
So we have moved forward with the 2022R3 migration, using the PDFDocument to build the PDF and save to a network location.
However, we are not using a stored procedure as datasource, but we are building a composite report (comprised of 15 separate datawindows)
However, most of the headers say "release 12.5;" and a couple say "release 19;"
Another thing that is peculiar in diagnosing this bug, from my development machine, while running the executable, I have no issues completing the process which calls IMPORTDATAWINDOW (which is triggering the error message above for one of our users), followed by calling SAVE using PDFDocument. Not sure if other users are also experiencing the same issue, but clearly it is has been an issue for this one user.
Last thing, the error is fired the first time through the code, the next time the user runs it saves without issue.
I am wondering if one suggestion to update the release header to 22 from what is listed for previous versions (release 12.5; release 19;) to see if that would work (in case the user has a dated machine - or does not have all the current updates).
Odd thing is, it works for this user the second passthrough.
And no other users have reported this.