04-24-2013 05:57 AM
I use the following (I wish I knew a better way to insert code) to download 1 page of a document.
private int DownloadOne(string fn, DocumentList docList)
{
Document document = docList[0];
Rendition rendition = document.DefaultRenditionOfLatestRevision;
fn = String.Format(fn, 1);
using (PageData pageData = imageDataProvider.GetPage(rendition, 1))
{
using (Stream stream = pageData.Stream)
{
Utility.WriteStreamToFile(stream, fn);
}
}
return 1;
}
I use PageRangeSet and PageDataList instances for downloading a specific number of pages.
How in the world do I download all the pages of a document when I don't know ahead of time how many pages it has?
Thanks
04-24-2013 06:37 AM
The Rendition object has a property called NumberOfPages. This will (as the name implies) return the number of pages in the document. This property only works with TIFF images.
Also, to insert code, you can use the Syntax Highlighter button in the bottom row of controls all the way to the right, just next to the smilies.
04-24-2013 07:27 AM
I knew there had to be a way to get that value! I tried everyting under the sun except the Rendition object.
Thank you, Tim.
04-24-2013 06:44 AM
Also if you want to get all pages of an image document (and not just specific pages or a page range) you could call the GetDocument method off of the image data provider and pass in the rendition. This will get the entire document as one Group-4 tiff page data.
04-24-2013 06:45 AM
This is all I have to download a full image document. Assuming you have the relevant objects already set up.
pageData = app.Core.Retrieval.Image.GetDocument(Document.DefaultRenditionOfLatestRevision);using (FileStream fileStream = File.Create(strFilePath)){ pageData.Stream.CopyTo(fileStream);}
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.