Free Support Forum - aspose.com

DOC to TIFF conversion generates stretched result when vertical and horizontal resolution is set using Java

Hello, I’m doing conversion from doc to tiff and I want to say different values for horizontal and vertical dpi. There’s API for it and the resulting image have correct values for horizontal resolution and vertical resolution. But when I use different values there, the resulting image is stretched in one of the dimensions. Is there a way to preserve the correct size of the page and set different values? I don’t see a method to set page size in pixels.

Attaching examples of correct tiffs with different vertical and horizontal resolutions:
different-vertical-horizontal-resolutions.zip (235.9 KB)

@astafev

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output TIFF file that shows the undesired behavior.
  • Please attach the expected output TIFF file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor any document would fit. Attaching the code and the example of a txt file for simplicity. You can open the tiff file (1.tiff) and see that the image is stretched and not readable. In the original message I attached tiff files with different vertical and horizontal resolution which are not stretched, that’s the expected output.

example-txt.zip (297.1 KB)

import com.aspose.words.Document;
import com.aspose.words.ImageSaveOptions;
import com.aspose.words.SaveFormat;

public class A {
public static void main(String[] args) throws Exception {
    Document doc = new Document("meat_2pages.txt");
    ImageSaveOptions options = new ImageSaveOptions(SaveFormat.TIFF);
    options.setVerticalResolution(96);
    options.setHorizontalResolution(196);
    doc.save("1.tiff", options);
}
}

@astafev

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-2393 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.