I'm getting some strange behavior from the SDK in a workflow designed to import one-page TIF files into a multi-page Laserfiche document.
The workflow looks like this:
And my custom query returns 50 results:
However, running the code below inserts 51 pages into my freshly created document (verified that it starts with 0 pages), and the only file path that I can get the DocumentImporter to import is from the first line of the database I'm looking up, and that imports into page 51. All other pages say there is no associated image.
// Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session // Instantiates the current document as 'currentDocument' DocumentInfo currentDocument = Document.GetDocumentInfo(BoundEntryId, RASession); // The root path of the originating database/ cabinet files string rootPagePath = redacted; // The page in the directory (currently finds all file types, need to refactor to just find TIFs) string pagePath = rootPagePath + GetTokenValue("ForEachRow_subdir") + "\\" + GetTokenValue("ForEachRow_page_id") + ".TIF"; // set the page number int pageNum = (int)GetTokenValue("ForEachRow_pagenum"); PageRange pageRange = new PageRange(pageNum.ToString()); // Write TIF page data to a new page //Create a new page at the end of the document PageInfo pInfo = currentDocument.InsertPage(pageNum); // Configure the document importer object DocumentImporter importer = new DocumentImporter(); importer.Document = currentDocument; importer.OcrImages = false; // add the page to the new page importer.ImportImages(pagePath, pageRange); // puts the image (at the arg 1 path) into the document (at arg 2 path)
I can't find anything in the documentation that would explain this behavior, and I explicitly insert the pages at the desired index because I'm aware that some LF SDK methods start at a 1 index and I wanted to be sure.
My error logs also show that the pageNum and pagePath variables are completely correct, and pageNum never hits 51. It always stops exactly at 50, and each iteration has a correct pagePath as well. No errors are thrown.
I'm at a loss. Can anyone see anything incorrect about how I've gone about this?