My company recently purchased another Aspose product, and it seems to work great. We now stumbled upon a use-case for which I can’t find an apparent solution - when converting a multipage tiff file to pdf, the individual pages seem to get stretched in the resulting pdf. We use the DOM-based API, heavily borrowed from here.
Document doc = new Document() OutputStream outputStream = new OptimizedByteArrayOutputStream() // Create a new page & set margins so image will fit Page page = doc.getPages().add() page.pageInfo.margin.bottom = 0 page.pageInfo.margin.top = 0 page.pageInfo.margin.left = 0 page.pageInfo.margin.right = 0 // Create an image object Image image = new Image() image.setInNewPage(true) image.setImageStream(sourceFileContent) // Add the image into paragraphs collection of the section page.getParagraphs().add(image) doc.save(outputStream)
As an example tiff file you can use this one, as we use it also in our tests.