Free Support Forum - aspose.com

PDF to TIFF conversion generating very small image

I am using the following code to generate a tiff from a PDF, taken directly from this site.
However the Tiff it generates only has the pdf page taking up about 1/4 of the generated tiff image. The image itself is the right size, but the tiff is only taking up about 1/4 of the page with the rest blank… I have tried playing around with the pagesize on the TIFFDEVICE constructor, but that seems to only affect the size of the overall tiff, it still shows the converted PDF as only 1/4 of the screen.

Is this a limitation of the evaluation package? or is there some setting somewhere so that it converts the PDF to a TIFF of equivalent size?

:

// Open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“test.pdf”);
// Create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream("output.tiff");

// Create Resolution object
Resolution resolution = new Resolution(300);
// instantiate TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
// set the compression of resultant TIFF image
tiffSettings.setCompression(CompressionType.CCITT4);
// set the color depth for resultant image
tiffSettings.setDepth(ColorDepth.Format8bpp);
// skip blank pages while rendering PDF to TIFF
tiffSettings.setSkipBlankPages(true);

// Create TiffDevice object with particular resolution
TiffDevice tiffDevice = new TiffDevice(com.aspose.pdf.PageSize.getPageLetter(),resolution, tiffSettings);

// Convert a particular page (Page 1) and save the image to stream
tiffDevice.process( pdfDocument, imageStream);
// Close the stream
imageStream.close();

@pecks2,

Please send us your source PDF, output TIFF and code. We will investigate your scenario in our environment, and share our findings with you.

Certainly, Here you go.

test.pdf (384.0 KB)

Your upload will not allow a .tiff or .tif extension, so i have renamed the tif file to be a .png but it is the .tif output

output.png (54.6 KB)

@pecks2,

We have tested your scenario with the latest version 18.5 of Aspose.PDF for Java API, and the output TIFF looks fine. This is the ZIP of the output TIFF file: output18.5.zip (122.9 KB)

I am using 18.5, the output files I sent were generated with 18.5 on a Mac.

from my gradle file:

maven {
url “https://artifact.aspose.com/repo/
}

compile group: ‘com.aspose’, name: ‘aspose-pdf’, version: ‘18.5’

@pecks2,

Please send all details of the MAC operating system (name & version), JDK (version & update) and a ZIP of the output TIFF file. Your response is awaited.

I am running OSX 10.11.6 and using JDK is 1.8.0_111output.tiff.zip (43.9 KB)

It seems to be the resolution setting I am using… changing it to 100 seems to make the PDF to TIFF the full page… However the resolution of the resulting tiff seems very poor… is there a setting to improve this?

Change compression type and that seems to have fixed the resolution of the resulting tiff.

@pecks2,

Please create an output TIFF file with resolution 300 in your environment, and then send us a ZIP of the TIFF file and also let us know the compression type. Your response is awaited.