We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting the screenshot of the first page of a document

Hi All,


I am looking at Aspose product to provide the functionality to screenshot the first page of a document, and save it as an image. The document can be PDF, word doc or excel.
Anyone has any idea if Aspose has an API that I can leverage to deliver this requirement?

Thank you

Regards,
Andy Taslim

Hi,


Well, in case of rendering first page of the Excel file’s sheet to image file, you may utilize Sheet to Image feature provided by Aspose.Cells product, see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Converting+Worksheet+to+Image+and+Worksheet+to+Image+by+Page#ConvertingWorksheettoImageandWorksheettoImagebyPage-pages

Here is the sample code to render an image of the worksheet’s first page for your reference:

Sample code:
Workbook book = new Workbook(“e:\test\Testbook2.xls”);
Worksheet sheet = book.Worksheets[0];
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;

//Sheet2Image first Page conversion
SheetRender sr = new SheetRender(sheet, options);
sr.ToImage(0, “e:\test\” + sheet.Name + " Page1" + “.jpg”);


Thank you.

Thank you Amjad for the reply. What about PDF and word doc?

Hi,


Please stay tuned and wait a bit as my fellow colleagues from Aspose.Words and Aspose.Pdf teams would help you soon here regarding .pdf and .doc file formats.

Thank you.

Hi Andy,

Thanks for contacting support.

I would like to share information related to PDF file format. We have a component named Aspose.Pdf for .NET which provides the capability to create as well as manipulate existing PDF files. It also offers the capability to convert PDF pages to Image (JPEG, PNG, GIF, TIFF etc) format. Please visit the following link for further information on Convert particular PDF page to JPEG Image

Hi Andy,


Thanks for your inquiry and sorry for the delayed response. I would like to share information related to Word file format. To save particular pages in Microsot Word document to separate JPEG image files, please run the following code snippet:

Document document = new Document(@“C:\test\In.docx”);

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Jpeg);
options.PageCount = 1;

for (int i = 0; i < document.PageCount; i++)
{
options.PageIndex = i;
document.Save(string.Format(@“C:\test\out_{0}.jpg”, i), options);
}

I hope, this helps.

Best regards,