cancel
Showing results for 
Search instead for 
Did you mean: 

Get PageData from UnindexedDocument object

Jeremy_Buffingt
Champ in-the-making
Champ in-the-making

I'm working with a Unity Script that processes documents in a scan queue before they're indexed.  Among the args is the document, which is of type UnindexedDocument.  I'd like to get at the document content, but the UnindexedDocument class doesn't have the DefaultRenditionOfLatestRevision object property like a Document object does, and every GetPage method of every DataProvider requires a Rendition object.

How do I get a Rendition of the Unindexed Document and/or otherwise retrieve the PageData of the document?  I attempted a quick hack of calling the app.Core.GetDocumentByID([Doc Handle]), but it comes back null, so no dice.  Thanks!

1 ACCEPTED ANSWER

Avram_Adam
Champ on-the-rise
Champ on-the-rise

You can do this but it has to have a doctype. I created a doctype with one keyword that I use as the file name (application ID). The user types in the application ID, hits scan, and the document is exported to disk with the application ID as the filename. This could also be done programmatically so the user does not have to enter a keyword and the filename is established within the script.

public void OnFullIndexExecute(Hyland.Unity.Application app, Hyland.Unity.ScanQueuePostScanFullIndexEventArgs args)
 {
filename = "Test Doc";

 // get current doc
 Document document = args.Document;
 //find the image rendition of the document
 Rendition rendition = args.Document.DefaultRenditionOfLatestRevision;
 // init PDF data provider
 PDFDataProvider imageProvider = app.Core.Retrieval.PDF;

 using (PageData pageData = imageProvider.GetDocument(rendition))
 {
 // use extension from page data object and create path
 string fullPath = @"\\ls2\shortcut\Imaging\Document Conversion Staging Area\" + filename + "." + pageData.Extension;//extension will be PDF
 // Create file
 using (Stream stream = pageData.Stream)
 {
 Utility.WriteStreamToFile(stream, fullPath);
 }
 }
 Storage storage = app.Core.Storage;
 // remove document from scan queue
 storage.PurgeDocument(document);
 }

View answer in original post

3 REPLIES 3

Ryan_Arians
Champ on-the-rise
Champ on-the-rise
We also ran into this issue and would like to know if there is a solution.

Karen_Wood
Confirmed Champ
Confirmed Champ

Jeremy,

There is currently no way to get the PageData of an UnindexedDocument using the Unity API. If this functionality is something that you would like to see added, you can contact your first line of support to create a Software Change Request.

Avram_Adam
Champ on-the-rise
Champ on-the-rise

You can do this but it has to have a doctype. I created a doctype with one keyword that I use as the file name (application ID). The user types in the application ID, hits scan, and the document is exported to disk with the application ID as the filename. This could also be done programmatically so the user does not have to enter a keyword and the filename is established within the script.

public void OnFullIndexExecute(Hyland.Unity.Application app, Hyland.Unity.ScanQueuePostScanFullIndexEventArgs args)
 {
filename = "Test Doc";

 // get current doc
 Document document = args.Document;
 //find the image rendition of the document
 Rendition rendition = args.Document.DefaultRenditionOfLatestRevision;
 // init PDF data provider
 PDFDataProvider imageProvider = app.Core.Retrieval.PDF;

 using (PageData pageData = imageProvider.GetDocument(rendition))
 {
 // use extension from page data object and create path
 string fullPath = @"\\ls2\shortcut\Imaging\Document Conversion Staging Area\" + filename + "." + pageData.Extension;//extension will be PDF
 // Create file
 using (Stream stream = pageData.Stream)
 {
 Utility.WriteStreamToFile(stream, fullPath);
 }
 }
 Storage storage = app.Core.Storage;
 // remove document from scan queue
 storage.PurgeDocument(document);
 }