docSrc.SaveToImage(0, 1, @“C: ests.jpg”, null);
is same of the size as of page, any way to save is same as size of text, any possible way to ignore empty spaces?
docSrc.SaveToImage(0, 1, @“C: ests.jpg”, null);
is same of the size as of page, any way to save is same as size of text, any possible way to ignore empty spaces?
Hi
Thanks for your query. Please use the latest version of Aspose.Words for .NET and use RenderToSize or RenderToScale methods of Document Class. Let us know, If you have any more queries.
private static void SaveToImage(Document doc, int pageIndex, string imageName, int width, int height)
{
using (Bitmap bmp = new Bitmap(width, height))
{
// User has some sort of a Graphics object. In this case created from a bitmap.
using (Graphics gr = Graphics.FromImage(bmp))
{
Color backgroundColor = doc.PageColor;
if (backgroundColor == Color.Empty)
backgroundColor = Color.White;
gr.FillRectangle(new System.Drawing.SolidBrush(backgroundColor), 0, 0, width, height);
gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
gr.PageUnit = GraphicsUnit.Pixel;
doc.RenderToSize(pageIndex, gr, 0f, 0f, width, height);
bmp.Save(imageName);
}
}
}
problem is still the same, how do i calculate the exact width & height of the text, not the complete page!
i just need the image to be sized same as text’s!
Hi,
Please accept my apology for late response. I regret to share with you that Aspose.Words does not support the requested feature. However, I will try to share a workaround soon.
Hi there,