It's not clear from the documentation whether this call can convert a text file to a PDF.
At a minimum, this call should throw a more descriptive exception, e.g. UnsupportedFileType or something similar. Ideally, of course, it should be able to convert a text document into PDF.