cancel
Showing results for 
Search instead for 
Did you mean: 

Download all pages of a tiff image, Onbase ver 9.2

Jon_Jacobs
Champ in-the-making
Champ in-the-making

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

5 REPLIES 5

Timothy_Cosgrif
Star Collaborator
Star Collaborator

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.

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.

Sarah_Katzer
Champ on-the-rise
Champ on-the-rise

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.

 

 

John_Anderson4
Star Collaborator
Star Collaborator

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);}