SaveToImage

Hi,
I used aspose.word to open two mht file and used savetoimage method to save them into ccit4 tiff images files. but the result is a bit off. Here my issues:

See attachment for sample file
For 01.mht: the table is cut off and rest of the table never gets printed. Is there a way where we can fit the table into 1 page or show the rest of the table on a subsequent page?

For 02.mht: the picture is cut off and the background is all black. How can I get the picture to fit in 1 page and have the background be white instead of black?

Thank you for your help.

Hi,

Thanks for using Aspose.Words

I quickly generated .tiff files off your templates and found that the output on the first document looks as expected, only the long row that spans across the width is being cut off, this is expected as it's too long for the page. You can choose to rework this to fit it in, or maybe change paper orientation to Landscape Also which version of Aspose.Words are you using?

For the second document again I believe it is being cut off because it's too big for the page. You can simply try changing the paper orientation to fix this:

foreach (Section section in doc2.Sections)

section.PageSetup.Orientation = Orientation.Landscape;

You can also set the Paper color when rendering by using this property in the ImageOptions class:

options.PaperColor = Color.White;

If these points do not solve your issues can you please attach your code and your output tiff here and we will provide some further suggestions.

Thanks,

the requirement for the tiff from my boss is portrait orientation. can’t do landscape. is there a way that I can do like zoom out and fit all of the content into the tiff but with smaller words or smaller pictures? How do I do that?

I tried to set the paper color to white but it didn’t seem to work for me. I’ll try again.

Hi,

Thanks for providing this extra information.

You can fit the output onto one page by increasing the paper size. Please see the code below:

foreach (Section section in doc.Sections){

section.PageSetup.PageHeight = ConvertUtil.InchToPoint(13.8);

section.PageSetup.PageWidth = ConvertUtil.InchToPoint(16.5);

}

This will increase the page size so that the content including the large table will fit onto one page.

Please note that this will increase the output resolution of the tif file, you may need to resize this in your code if it is too big.

You can also set each part of the content to having a different size if needed, you would just need to set up some section breaks and change the code a bit.

If you need any further help please feel free to ask.

Thanks,