You are viewing limited content. For full access, please sign in.

Question

Question

Return a PDF as Array of Bytes

SDK
asked on September 5, 2013

Dears,

 

With Laserfiche SDK, it is possible to search for a PDF document and return it as array of bytes.

 

 

Our question is regarding the Workflow Web Service. We need to know if it can return an array of bytes which can be used with a third party web site? For example:

 

- Call a web service from a third party website.

- The Web Servicve triggers a workflow.

- The Workflow Search for a document and return it as array of bytes.

- The Web Site gets the array of bytes.

 

Thanks,

Dory

 

 

 

 

0 0

Answer

APPROVED ANSWER
replied on September 5, 2013

Create a Stream.IO.MemoryStream instance, pass it to DocumentExporter.ExportElecDoc as Pava mentions, then call MemoryStream.ToArray to get the byte array. If you are doing this in a loop it is more efficient to create one byte array that's big enough to hold the largest PDF you will export and pass that to MemoryStream so you aren't allocating so many arrays.

1 0

Replies

replied on September 5, 2013

The DocumentExporter.ExportElecDoc method in DocumentServices has two overloads - both take an electronic file and one exports as a file (string to the file path) and the other outputs as a stream.

 

Note that if you are trying to export an entry that is already a PDF inside the Laserfiche repository, you want to use ExportElecDoc. If its an image file that you want to convert to PDF during the export, you would use the ExportPdf methods (which also has a stream overload).

2 0
replied on September 6, 2013

Dears,

 

Following to Dory's question, I need to clarify that our main concern is to know if the Workflow web Service (used to invoke a workflow) can return the workflow output parameters as result.

 

We have created an application that trigger a Laserfiche workflow using the Laserfiche Workflow Web Service, and give it as input parameter an entry ID.

 

Based on the input parameter my workflow get a PDF file from the Laserfiche repositry, convert it to array of bytes, and return the array as output parameter.

 

What we need to know is how can we get the output parameter, as returned value, from this workflow web service.

 

Regards,

Miled

0 0
replied on September 6, 2013

The Workflow Web Service does not notify when workflows are complete. It can only be used to start workflows.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.