cancel
Showing results for 
Search instead for 
Did you mean: 

Retreiving PDF document using unity API

Milind_Panwalka
Champ on-the-rise
Champ on-the-rise
  1. I have stored a PDF document in onbase in a document type whose default file format is image file format. The document is stored with file format 16 and with an extension of PDF.
  2. I am trying to retrieve the document using PDFdataprovider but I get a blank document.
  3. I can retrieve the document if I use imageDataProvider and retrieve it to a tiff file.

 

Since this is a PDF document I want to retrieve it as pdf and not as an image. My code is as follows.

 

Core core = g_application.Core;

  

DocumentQuery docQuery = core.CreateDocumentQuery();

 

docQuery.AddKeyword("Docket ID", docketId, KeywordOperator.Equal,KeywordRelation.And);

               

DocumentList docList = docQuery.Execute(docQuery.ExecuteCount(), DocumentRetrievalOptions.LoadKeywords);

                

PDFDataProvider pdfProvider = g_application.Core.Retrieval.PDF;

 

foreach (Document doc in docList)

{

        Revision revision = doc.LatestRevision;

 

        Rendition rendition = revision.DefaultRendition;

 

       PageData pageData = pdfProvider.GetDocument(rendition);

 

      // Create new memory stream object

                       

        MemoryStream ms1 = new MemoryStream();

 

       pageData.Stream.CopyTo(ms1);

       pageData.Stream.Close();

 

                       

 

        // Convert Memory stream to byte array

           

        byte[] buffer = ms1.ToArray();

 

       return byte array to calling method

}

2 REPLIES 2

Ujjwal_Shrestha
Champ in-the-making
Champ in-the-making

Hi Milind

Have you tried using NativeDataProvider instead ?

Thanks

Milind_Panwalka
Champ on-the-rise
Champ on-the-rise

I was using the wrong version of Acrobat. This problem is solved.