Hello, I want to create a multi-page tiff from a word (excel, powerpoint etc) document by given start and end page number. My aim is to create thumbnails.
var doc = new Document(thumbnail.OriginalFileContent.ConvertToMemoryStream());
// Render Word document to an image stream
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
if (thumbnail.AllPages)
{
options.PageIndex = 0;
options.PageCount = doc.PageCount;
}
else
{
options.PageIndex = thumbnail.StartPage;
options.PageCount = thumbnail.EndPage- thumbnail.StartPage;
}options.TiffCompression= <span style="color:#2b91af;">TiffCompression</span>.Ccitt4;<span style="color:green;">// (TiffCompression.CCITT_4);</span> options.Resolution=160;<span style="color:green;">// .setResolution(160);</span> options.ColorMode = thumbnail.IsColored? <span style="color:#2b91af;">ColorMode</span>.Normal : <span style="color:#2b91af;">ColorMode</span>.Grayscale; <span style="color:#2b91af;">MemoryStream</span> imgStream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>(); doc.Save(imgStream, options);</pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Until here imgstream object holds multipage when i save as a tiff but when i want to resize it</pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><pre style="font-family: Consolas; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><span style="color:#2b91af;"> Document</span> temp = <span style="color:blue;">new</span> <span style="color:#2b91af;">Document</span>(); <span style="color:#2b91af;">DocumentBuilder</span> builder = <span style="color:blue;">new</span> <span style="color:#2b91af;">DocumentBuilder</span>(temp); <span style="color:#2b91af;">Shape</span> img = builder.InsertImage(imgStream); <span style="color:green;">// Resize the image as per your needs</span> img.Width = thumbnail.Width; img.Height = thumbnail.Height; <span style="color:green;">// Save the individual image to disk using ShapeRenderer class</span> <span style="color:#2b91af;">ShapeRenderer</span> renderer = img.GetShapeRenderer(); <span style="color:blue;">using</span> (<span style="color:blue;">var</span> outStream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>()) { renderer.Save(outStream, <span style="color:blue;">new</span> <span style="color:#2b91af;">ImageSaveOptions</span>(<span style="color:#2b91af;">SaveFormat</span>.Tiff)); result.Thumbnail = outStream.ToArray(); result.Result = <span style="color:#2b91af;">Result</span>.Successful; result.Message = <span style="color:#a31515;">$</span><span style="color:#a31515;">"A thumbnail has been successfully created"</span>; }</pre><pre style="font-family: Consolas; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></pre><pre style="font-family: Consolas; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">img Shape object holds only one page from the stream and it gives me the first page. </pre><pre style="font-family: Consolas; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;">Well how i can solve this problem?</pre><pre style="font-family: Consolas; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial;"><br></pre></pre></div>