cancel
Showing results for 
Search instead for 
Did you mean: 
Brian_Koning
Star Contributor
Star Contributor

The ability to export Documents via the DataProvider family of classes is a highly utilized feature of the Unity API. The different DataProviders retrieve Documents mainly as images, PDFs, or plain text but also supports retrieval of the original unaltered archived Document. One of the useful aspects of the ImageDataProvider, one of the more popular DataProviders, is the ability to convert a wide array of Document file types to an image. However, the resulting image was not always set with the appropriate DPI to the dimensions required and an external toolkit was necessary to manipulate this value.

With the release of OnBase 14 comes a new feature to the ImageDataProvider of the Unity API: the inclusion of the ImageGetDocumentProperties.DotsPerInch property for specifying an exported image's DPI.

Implementation

The DotsPerInch property is exposed off of the ImageGetDocumentProperties class which are passed into methods off of the ImageDataProvider. It is a settable integer representing the desired DPI of the exported image. All of the ImageDataProvider functions returning a PageData object have an overload accepting the ImageGetDocumentProperties which makes this property available for an entire Document or singular pages of the Document.

Example

Setting the DotsPerInch property should integrate seamlessly anywhere you are already using the ImageGetDocumentProperties class. Simply set the DotsPerInch property before passing the properties to GetDocument() or GetPages():

ImageDataProvider dataProvider = application.Core.Retrieval.Image;ImageGetDocumentProperties imageProperties = dataProvider.CreateImageGetDocumentProperties();imageProperties.DotsPerInch = 300;

The PageData returned by the ImageDataProvider has its DPI set appropriately:

Rendition rendition = document.DefaultRenditionOfLatestRevision;PageData pageData = dataProvider.GetDocument(rendition, imageProperties);

In Conclusion

The DotsPerInch property is a neat addition to the Unity API which has the opportunity to cut down on external code that needs to be written. With just a one line change, handing off Documents exported from OnBase to another third-party system should prove that much more seamless.

Please feel free to leave and comments or questions below. The Unity API team will be around to answer any questions that come up. Join us next time also; we'll be discussing the ability to specify compression quality for documents.