Link to file doesn't need for a file to exist, but the containing directory must exist and should be writable by a OS user (cacheusr in uyour case probably).
I'd try to write into a temp dir first, where you're sure you have access:
set file = ##class(%File).TempFilename("pdf")
set sc = stream2.LinkToFile(file)
quit:$$$ISERR(sc) screcord value of file somewhere (output to display or store in global) and check if the file was created).
%Save method also returns status, you should return it instead of $$$OK:
set sc = stream2.%Save()
quit sc- Log in to post comments
