OfficeToPdfConverter

The OfficeToPdfConverter provides a simple API to convert office documents to PDF documents.

The conversion happens by uploading the supplied office document to a running instance of Nutrient Document Engine. Nutrient Document Engine performs the conversion and then the resulting PDF is downloaded and returned by convertToPdfAsync.

Running the conversion requires the office conversion license on Nutrient Document Engine and may take a significant amount of time.

The following file types are supported:

  • Microsoft Word: .doc, .docx

  • Microsoft Excel: .xls, .xlsx

  • Microsoft Powerpoint: .ppt, .pptx

Example usage:

// Grab a JWT token to send to your server to authenticate this client.
val jwt = MyServerApi.obtainJwt(fileSha256)

// Create a OfficeToPdfConverter by passing in the path to the file to convert as well as to your server.
val file = OfficeToPdfConverter
.fromUri(context, Uri.parse("file:///sdcard/my_file.docx"), Uri.parse("http://www.myserver.com/"), jwt)
.convertToPdfAsync()
// Use the converted PDF.

For more information checkout our office conversion guide article.

Types

Link copied to clipboard
object Companion

Factory methods for OfficeToPdfConverter.

Functions

Link copied to clipboard
suspend fun convertToPdfAsync(): File

Performs Office-to-PDF conversion to a temporary file in the application's cache directory.

suspend fun convertToPdfAsync(outputFile: File)

Performs Office-to-PDF conversion to the specified file.