cancel
Showing results for 
Search instead for 
Did you mean: 

Should I be able to store a PDF document as an Image

Diane_Wagner_Sm
Confirmed Champ
Confirmed Champ

This is my code:

Try
If UnityConnect(env) Then
g_application.Timeout = 3000000

' Create the document Type object off of the core. Use the Find method to find the Document Type desired for the new document
Dim documentType As DocumentType = g_application.Core.DocumentTypes.Find(docType)

' Create the FileType object. Use the Find method to find the File Type desired for the new document
Dim fileType As FileType = g_application.Core.FileTypes.Find(2) '2 - Image File Format

' Create the Page Data object from the Storage class
Dim pageData As PageData = g_application.Core.Storage.CreatePageData(filePath)

' Create the Store New Document Properties from the Storage class
Dim newDocProperties As StoreNewDocumentProperties = g_application.Core.Storage.CreateStoreNewDocumentProperties(documentType, fileType)

' Add keywords for the new document using the StoreNewDocumentProperties object
For Each kw As KeywordPair In docKeywords
Dim kwType As KeywordType = g_application.Core.KeywordTypes.Find(kw.kwName)
Select Case kwType.DataType
Case KeywordDataType.AlphaNumeric
newDocProperties.AddKeyword(kw.kwName, kw.kwValue)
Case KeywordDataType.Numeric9
newDocProperties.AddKeyword(kw.kwName, CInt(kw.kwValue))
Case KeywordDataType.Numeric20
newDocProperties.AddKeyword(kw.kwName, CDec(kw.kwValue))
Case KeywordDataType.Date
newDocProperties.AddKeyword(kw.kwName, CDate(kw.kwValue))
End Select
Next

' Use the Storage class to store a new document using the page data and the new document properties
Dim newDoc As Hyland.Unity.Document = g_application.Core.Storage.StoreNewDocument(pageData, newDocProperties)

' Close the page data stream to make sure the file gets released
pageData.Stream.Close()

End If

Catch exUnity As UnityAPIException
Dim obError As String = exUnity.Message & vbCrLf & exUnity.StackTrace
Catch ex As Exception
Dim myError As String = ex.Message & vbCrLf & ex.StackTrace
Finally
UnityDisConnect()
End Try

This is the error I am getting:

An error occurred within the Unity API: Error code: (-38). Internal error. It usually means that there was an ArrayIndexOutOfBoundsException in the RasterMaster SDK for the JavaTM platform.
at Hyland.Unity.Application.Validate(Response response)
at Hyland.Unity.Application.ExecuteWithValidation(Request request)
at Hyland.Unity.Storage.StoreNewDocument(IEnumerable`1 pageDatas, StoreNewDocumentProperties props)
at Hyland.Unity.Storage.StoreNewDocument(PageData pageData, StoreNewDocumentProperties props)
at ServiceTest.ParentsToOnBase.DocumentToOnBase(String env, String docTypeGroup, String docType, List`1 docKeywords, String filePath) in C:\inetpub\wwwroot\GMRC_FormService\ServiceTest\ParentsToOnBase.aspx.vb:line 373

2 REPLIES 2

Daniel_Quill
Elite Collaborator
Elite Collaborator
Diane,The Unity API does not convert documents during the storage procedure. So, if you need to store a PDF as an Image you will need convert the PDF to an image prior to importing into OnBase. However, OnBase does have the ability to convert document to other file format types during export through the use of the different DataProviders such as ImageDataProvider and PDFDataProvider.Regards,

Diane_Wagner_Sm
Confirmed Champ
Confirmed Champ

I hoped for the best, but was prepared for the worst.

Based on the testing I have done I was afraid that was what the answer was going to be.

I have already switched to your suggestion of Plan B.

Thank you for responding and have a nice weekend.

Diane Asberry