Page 1 of 1

Save a pdf against a sales order

PostPosted: Thu Feb 06, 2020 12:37 pm
by SBarnes
How can I save a pdf that is in a memory stream (i.e. I am going to grab it from a URL) as a document attached to a sales order?

Re: Save a pdf against a sales order

PostPosted: Thu Feb 06, 2020 6:47 pm
by Mike.Sheen
All memory streams can be converted to a byte array easy enough, then it's just a matter of creating a new document and setting the FileBinary property to be that byte array and adding it to the documents collection of the sales order.

This seems to simple... I must be missing something...

Re: Save a pdf against a sales order

PostPosted: Thu Feb 06, 2020 6:50 pm
by SBarnes
It was more the physical file name, is that used when Jiwa reconstitutes the file?

Re: Save a pdf against a sales order  Topic is solved

PostPosted: Thu Feb 06, 2020 7:11 pm
by Mike.Sheen
SBarnes wrote:It was more the physical file name, is that used when Jiwa reconstitutes the file?


Ok, yep - we use that physical file name property to construct a path + physical file name when the user right clicks on the document and chooses "Open" or "Save" or whatever. We just need a file name to default to in order to make the users life easier - but you can make it anything you want - even just "document.pdf" will do.

Re: Save a pdf against a sales order

PostPosted: Tue Feb 11, 2020 3:03 pm
by SBarnes
Is there a quick way to get the default document type for a sales order?

Re: Save a pdf against a sales order

PostPosted: Tue Feb 11, 2020 3:12 pm
by Scott.Pearce
Code: Select all
salesOrder.Documents.DocumentTypes.GetDefaultDocumentType();