cancel
Showing results for 
Search instead for 
Did you mean: 

PDF's imported through the Unity API are corrupted

Smitha_Challa
Star Contributor
Star Contributor

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

3 REPLIES 3

Adam_Kuhn
Star Collaborator
Star Collaborator

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.

Smitha_Challa
Star Contributor
Star Contributor

Ok Done Thanks

Alex_French
Elite Collaborator
Elite Collaborator

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.