Free Support Forum - aspose.com

HTML -> TIFF Conversion

I have the conversion working from HTML to Tiff, but the problem is the Tiff Document needs to be in Landscape and is not, and I cannot find the place to make that change. As a result the Tiff document's format is not quite right.

Here is the code I have:

public void ConvertDoc(String inputFileName, String outputFileName)

{

Aspose.Words.Document _document;

LoadOptions options = new LoadOptions();

options.LoadFormat = LoadFormat.Html;

_document = new Document(inputFileName, options);

// Setup save options

ImageSaveOptions imgSaveOptions = new ImageSaveOptions(SaveFormat.Tiff);

imgSaveOptions.PageIndex = 0;

imgSaveOptions.PageCount = _document.PageCount;

imgSaveOptions.TiffCompression = TiffCompression.Ccitt3;

imgSaveOptions.Resolution = 160;

_document.Save(outputFileName, imgSaveOptions);

}

Hi Rene,


Thanks for your inquiry. Please use the following code snippet for your requirements. Let us know if you have any more queries.

<span lang=“EN-GB” style=“font-family:“Courier New”;color:#2B91AF;mso-ansi-language:EN-GB;
mso-no-proof:yes”>Document<span lang=“EN-GB” style=“font-family:“Courier New”;
mso-ansi-language:EN-GB;mso-no-proof:yes”> doc = new
Document(MyDir + “in.html”,
options);<o:p></o:p>

foreach (Section section in doc.Sections)

{

section.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;

}

// Setup save options

ImageSaveOptions imgSaveOptions = new ImageSaveOptions(SaveFormat.Tiff);

imgSaveOptions.PageIndex = 0;

imgSaveOptions.PageCount = doc.PageCount;

imgSaveOptions.TiffCompression = TiffCompression.Ccitt3;

imgSaveOptions.Resolution = 160;

doc.Save(MyDir + "AsposeOut.tiff", imgSaveOptions);

Perfect thank-you! That almost worked, Landscape was not quite wide enough so I ended up going with:

_document = new Document(inputFileName, options);

foreach (Section section in _document.Sections)

{

section.PageSetup.PageWidth = 1000;

}

Hi Rene,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.