10-16-2019 08:00 AM
We have an issue that is only affecting a single customer of ours. Our product is uploading document into OnBase through the Unity API. All file types with the exception of PDFs are importing into OnBase with no issues. PDFs are importing into OnBase via Unity API however, when you view them in OnBase an error message pops up that the PDF is corrupt. If we download the PDF out of OnBase using Unity API the PDF is corrupt.
We have verified that the PDFs are readable prior to the import through Unity API. We have been unable to reproduce this issue internally nor at any of our other customers.
If the customer in question uploads PDFs directly into OnBase using the OnBase client, the PDFs work just fine.
Could there be anything at the Unity API level that could cause this issue? Is there some environmental settings that are not set right?
The code we use is…
var pageDataForSave = storage.CreatePageData(ImageStream, ImageExtension);
var docType = obApp.Core.DocumentTypes.Find(DocumentTypeID);
var storeDocumentProperties = storage.CreateStoreNewDocumentProperties(docType, fileType);
//… we add 1 or more keywords using storeDocumentProperties.AddKeyword(KeywordTypeID, KeywordValue)
storeDocumentProperties.DocumentDate = DocumentDate;
var newDocument = storage.StoreNewDocument(pageDataForSave, storeDocumentProperties);
Our customer is using OnBase 17.0.2.78
10-16-2019 08:12 AM
Hi Smitha --
The code you've provided seems unproblematic but we would need to know more in order to say for sure that the problem isn't at the API layer. I recommend creating a Support Issue with us so we can look into this problem in greater depth.
10-16-2019 10:23 AM
Ok Done Thanks
10-16-2019 10:30 AM
In line
var pageDataForSave = storage.CreatePageData(ImageStream, ImageExtension);
does the string in "ImageExtension" have a leading period?
In v15, either "pdf" or ".pdf" worked. In some versions of v17 only ".pdf" will work correctly. An extension without a leading dot will be ignored, the PDF will be imported assuming the default extension of the default file type, and hilarity (or trouble) will ensue.
Along with checking your code, you might look into the database and the files on disk (if you're comfortable finding that) to see whether the actual file on disk in the Disk Group has the expected PDF file extension or not, and whether it is openable or not.
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.