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

Free Support Forum - aspose.com

Save doc as jpeg (using ASP Classic)

Easy to open a doc in vbscript (using ASP classic):
Set objWord = CreateObject("Aspose.Words.ComHelper")
Set objDoc = objWord.Open(myFileName)
objDoc.Save myNewFileName

Works fine. But how can I save as a JPEG?

I tried:
objDoc.Save myFileNameJPEG, 104

But results in an error:

Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'objDoc.Save'

There has got to be pretty straightforward solution. Please assist, thanks.

Hi Bill,

Thanks for your inquiry. Please note that COM does not
support method overloads. Therefore, methods that have overloads is
exposed by COM Interop with a numeric suffix added to them, except for
the very first method that stays unchanged. For example, Document.Save method overloads become Document.Save, Document.Save_2, Document.Save_3, and so on.

In your case, I suggest you please use Document.Save_2 method.
E.g objDoc.Save_2 myFileNameJPEG, 104

That’ll work.

Using this method, is there a way to specify a particlar size of the JPEG?
Hi Bill,

Thanks for your inquiry. In your case, I suggest you please create a wrapper class and use the following code example to change the output image size.

Please read following link for your kind reference.
How to create a wrapper to assist in calling Aspose.Words methods from classic ASP.

Document doc = new Document(MyDir + "in.docx");

// This defines the number of columns to display the thumbnails in.

const int thumbColumns = 1;

// Calculate the required number of rows for thumbnails.

// We can now get the number of pages in the document.

int remainder;

int thumbRows = Math.DivRem(doc.PageCount, thumbColumns, out remainder);

if (remainder > 0)


// Lets say I want thumbnails to be of this zoom.

const float scale = 0.50f;

// For simplicity lets pretend all pages in the document are of the same size,

// so we can use the size of the first page to calculate the size of the thumbnail.

Size thumbSize = doc.GetPageInfo(0).GetSizeInPixels(scale, 96);

// Calculate the size of the image that will contain all the thumbnails.

int imgWidth = thumbSize.Width * thumbColumns;

int imgHeight = thumbSize.Height * thumbRows;

using (Bitmap img = new Bitmap(imgWidth, imgHeight))


// The user has to provides a Graphics object to draw on.

// The Graphics object can be created from a bitmap, from a metafile, printer or window.

using (Graphics gr = Graphics.FromImage(img))


gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;

// Fill the "paper" with white, otherwise it will be transparent.

gr.FillRectangle(new SolidBrush(Color.White), 0, 0, imgWidth, imgHeight);

for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)


int columnIdx;

int rowIdx = Math.DivRem(pageIndex, thumbColumns, out columnIdx);

// Specify where we want the thumbnail to appear.

float thumbLeft = columnIdx * thumbSize.Width;

float thumbTop = rowIdx * thumbSize.Height;

SizeF size = doc.RenderToScale(pageIndex, gr, thumbLeft, thumbTop, scale);

// Draw the page rectangle.

gr.DrawRectangle(Pens.Black, thumbLeft, thumbTop, size.Width, size.Height);


img.Save(MyDir + "Rendering.Thumbnails Out.png");



Moreover, If you need to use many of the Aspose.Words classes, methods and properties, consider creating a wrapper assembly (using C# or any other .NET programming language), that will help to avoid using Aspose.Words directly from unmanaged code.

A good approach is to develop a .NET assembly that references Aspose.Words and does all the work with it, and only exposes the minimal set of classes and methods to unmanaged code. Your application then should work just with your wrapper library.

Reducing the number of classes and methods that you need to invoke via COM Interop could simplify your project, because using .NET classes via COM Interop often requires advanced skills.

being patient.