Render single pages

Hi,

I want to render a sinlge page tiff out of a multipage docx-Document. I have tried the following:

var doc = new Document(fileName);
var saveOptions = new ImageSaveOptions(SaveFormat.Tiff)
{
    PageIndex = pageIndex
};
doc.Save(tiffFileName, saveOptions);

For every mutlipage doc or docx, that I tried, the result is the same. For pageIndex == 0 the whole document is rendered into a multipage tiff. For every other pageIndex the tiff is empty. What I want, is a single page tiff, that just contains a single page of the docx.

I am using Aspose.Words with assembly version 11.5.0.0.

What can I do?

Thanks and best regards,

Peter Wolf

Hi Peter,

Thanks for your query. Please use the following code snippet for your requirements. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "Rendering.doc");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.PageIndex = 0;
options.PageCount = 1;
doc.Save(MyDir + "AsposeOut.tiff", options);
// Convert all pages to Tiff images
Document doc = new Document(MyDir + "in.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.PageCount = 1;
for (int pageIndex = 0; pageIndex <doc.PageCount; pageIndex++)
{
    string outputFileName = MyDir + string.Format("{0}_{1}.tiff", "Out", pageIndex + 1);
    options.PageIndex = pageIndex;
    doc.Save(outputFileName, options);
}

Of course, I forgot to set the page count. Thank you very much!

Hi Peter,

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