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

Question

Question

how to copy a tif file from a web service and save it in the repository or windows using SDK script workflow

SDK
asked on June 22, 2018

hi,

how to copy a tif file from a web service and save it in the repository or windows using SDK script workflow?

I have a web services that returns a tif image in Convert.ToBase64String format and that the SDK script workflow converts to System.Drawing.Image and then store it in a windows folder but I have the following error?

 

Thanks

 

 

 

0 0

Replies

replied on June 22, 2018 Show version history

You shouldn't need to go through GDI for this. I do something similar where I download TIFs from SSRS and save them to the repository. I use HttpClient and get the results as a byte array which then gets put into a MemoryStream.

Then you can use DocumentImporter to add the TIF images to a DocumentInfo instance. You can also do OCR as you bring the pages in.

Here's a snippet. You should be able to convert that string straight into a byte array. Let me know if you need more information.

var importer = new DocumentImporter();
importer.Document = doc;
importer.OcrImages = true;
importer.OcrOptions.OptimizationMode = OcrOptimizationMode.Accuracy;

var base64String = "";
var ms = new MemoryStream(Convert.FromBase64String(base64String))
importer.ImportImages(ms);

 

2 0
replied on July 19, 2018

Devon, is there any chance that you can share your full code from downloading and storing TIFs from SSRS?  I've just started working on a Workflow to accomplish the same task.

Thanks,

Rob

 

0 0
replied on July 19, 2018

Yeah. I'm working on a GitHub repo that contains a couple of variations. I'll update this thread when I get it up.

1 0
replied on July 20, 2018 Show version history

@████████

Here you go.

https://gist.github.com/devingoble/a9fc58a42112c98cbba17df8e6c7cdc5

 

Edit:

I've also posted my supercharged version that uses SQL Server in Docker, in-memory report rendering, parallelism, and lots of duct tape to run at about 4x the speed of the first method.

https://gist.github.com/devingoble/74cec595c3f8eaf51df428b2c1f1c559

 

I'm happy to answer any questions, but this code doesn't come with any warrantees. Some of it is highly specific to my environment, but there should be some good principles that you can learn from.

3 0
replied on July 23, 2018

Thanks so much Devin! 

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

Sign in to reply to this post.