Streamcontainer to operation original filename won't be set
Trying to pass pdf to save to custom file using default Trying to pass pdf to save to custom file and %f. but oriignal filename didn't send (it does in terminal). What is missing from setting filename from stream? can the file passthrough not out of box use outputfilename or has wrong default one been sent.
set fname="ThisHasBeenChanged.pdf"Set test = ##class(File.EpacsPDF).%OpenId(1)
set tempStream=##Class(%Stream.FileCharacter).%New()
Set sendstream = ##Class(Ens.StreamContainer).%New()
set sendstream.OriginalFilename=fname
set sendstream.OutputFilename=fname
Set tempStream= test.document
//Set the stream of the StreamContainerset tSC= sendstream.StreamSet(tempStream)
set tsc =..SendRequestAsync(..ForwardComponentName,sendstream,0).png)
Comments
I think the setstream wipes out the originalFilename field but the other way around results in zero bytes
Thank you for this comment, Mark. I had a similar problem which was driving me bonkers and turns out the order does matter as you pointed out. Need to do SetStream() first before setting the OutputFilename and OriginalFilename.
set streamContainer=..CreatePythonPDFStream()
set streamContainer.OriginalFilename="test2.pdf"issue did not happen whenever finished this with python (more complex) and it coming from a classmethod so unsure what the problem was
You can try the below command instead of Set tempStream= test.document
do tempStream.write(test.document)
What's the class/type of test.document property?
sendstream.OriginalFilename is replaced/modified by the StreamSet() method