Handling of Documents via /content?format=pdf REST API

Once we get the file bytes from the API is there a standard tool or API you'd recommend to format the document into a letter format (8.5x11)? We are accessing the M-Files REST API through one of our internal applications based on JAVA 8. Formatting the document using a 3rd party library works, but is terribly inefficient. Any help would be awesome.