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

Question

Question

Errors while importing with the SDK

SDK
asked on May 15, 2018 Show version history

I've been using the following code as part of a migration process:

			var decoder = new LfiBitmapDecoder(reportImage, BitmapCreateOptions.None);
			var encoder = new LfiBitmapEncoder(LfiContainerFormat.Tiff);

			foreach (var frame in decoder.Frames.ToList())
			{
				LfiBitmapSource source = new LfiWriteableBitmap(frame.DecodeBitmap());
				var bw = new LfiGrayscaleThresholdBitmap(source, BITONAL_THRESHOLD);
				var newFrame = new LfiBitmapFrame(bw, LfiBitmapCodec.FaxGroup4);
				encoder.Frames.Add(newFrame);
			}

I periodically get the following:

OR

OR very rarely

I don't know if the above code is the proper way to do what I'm attempting. Basically, I had some legacy data that is in an old database. I've converted it into reports that I download as TIFFs from SSRS. The problem with the images that come from SSRS is that they have RGB subpixel rendering and need to be smashed down to black and white. They are also multi-page files. I played around and came up with the above code to correct those issues. I can include more if needed.

Is the error that I'm seeing a result of me using the SDK libraries incorrectly, or is something else going on? It's definitely not consistent. If I run the process multiple times, it will not trip up on the same document each time. I just did a run of 150 documents, and got the error 27 times.

0 0

Replies

replied on May 15, 2018

I'm not sure what you're entire process is, so this may be an irrelevant question, but do you have Import Agent? Nothing wrong with the SDK, but Import Agent makes it incredibly easy to handle multi-page TIFF imports and B&W/monochrome conversion.

I can understand that Import Agent might not be ideal if this is just one part of a multi-step process, but I thought I would throw that out there anyway since it would address some of the challenges you're facing with pre-built functionality.

1 0
replied on May 15, 2018

We have import agent. Ordinarily that would be a great suggestion. However, it isn't able to provide what we need without pairing it with some workflows. I'm trying to avoid the overhead that will be required to bring in several million documents. I've already choked Workflow a few times by running it out of transaction log space, and this is much larger than anything we've done before.

This issue isn't really a show stopper. I already added some retry logic, but I'm just raising it to see if anybody from Laserfiche might have any ideas or guidance.

0 0
replied on May 15, 2018

Understandable. Just for the sake of clarity, what kind of activities did you need to do with Workflow? I'm assuming it is more complicated than just assigning metadata and setting destination folder since that can be done with XML/LST import files.

0 0
replied on May 16, 2018

We're batching the imports to reduce the load on both SSRS and Laserfiche, doing some image tweaks, assigning metadata, adding annotations, setting up link groups, logging status and errors. It's nothing that we couldn't do in multiple stages with various Laserfiche tools. It just makes sense in this scenario to consolidate into a single script.

I figured it was safe to use the SDK, and for the most part it works great. Maybe I'm pushing throughput on these libraries a little too hard. Although sometimes the very first document will have errors.

0 0
replied on April 15, 2021

I recently needed to use this code again, and figured out that trying to enumerate over LfiBitmapDecoder.Frames is possibly part of the issue. If I extract the frames into an IEnumerable<LfiBitmapFrame> and then loop through that, then the problem completely goes away. 🤷‍♂️

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

Sign in to reply to this post.