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

Free Support Forum - aspose.com

Reading file with bunch of pages

hi,

I’m evaluating your Aspose.Words and got a small issue. I attached a relatively small file for our company, usually they have more than 600 pages. The one attached has just 258 pages.

Using your sample that comes with evaluation package, I try to open and render it.

Opening works relatively fast (~2 sec), but rendering only the first page takes at least 3 mins which is unacceptable.

Just try to open and preview the attached document in your .NET DocumentExplorer sample app and you’ll see the issue.

Is there any way to fast render a given page from that “large” document.

PC specs

CPU: I7 980X extreme

RAM: 12Gb

Windows 7 Ultimate x64

Hi

Thanks for your inquiry. MS Word document is flow document and does not contain any information about its layout into lines and pages. So there is no way to determine where page starts or ends. That is why Aspose.Words builds layout of the whole document. Usually, Aspsoe.Words renders 10 pages per second. I used the following code for testing:

DateTime p1 = DateTime.Now;
Document doc = new Document(@"Test001\in.docx");
DateTime p2 = DateTime.Now;
Console.WriteLine("Loaded in: {0} sec", (p2 - p1).TotalSeconds);
doc.UpdatePageLayout();
DateTime p3 = DateTime.Now;
Console.WriteLine("Rendered in: {0} sec", (p3 - p2).TotalSeconds);
doc.Save(@"Test001\out.pdf");
DateTime p4 = DateTime.Now;
Console.WriteLine("Saved to PDF in: {0} sec", (p4 - p3).TotalSeconds);

And here are results:

Loaded in: 1,103063 sec
Rendered in: 12,9927432 sec
Saved to PDF in: 2,7321563 sec

As you can see document was rendered in 12-13 seconds (258/13 ~ 19pages/sec). My PC must be a bit slower than yours:

CPU: AMD Phenom II X6 1055T
RAM: 4Gb
OS: Windows 7 Proffesional x64

So it is quite strange why rendering on your side takes so long.

Best regards,

that’s not the code I’m using, I took the code from your DocumentExplorer application. Try to open my document in that program and you’ll see the issue.

There we have

PageInfo pageInfo = _document.GetPageInfo(pageNumber);

this is where everything hangs on first call. after this it works ok. But first call is taking way too long time.

Well, I know why you got so good times. Is all because you didn’t set the license. When I used your code I got relatively same times, however after I added

License l = new License();
l.SetLicense(@"t:\down\aspose\Aspose.Total.lic ");

before loading the document I got such times

Loaded in: 0.7670439 sec
Rendered in: 261.2309415 sec
Saved to PDF in: 3.6142067 sec

that shows exactly the picture I have.

Let me know how it works in your case.
Thx

Hi

Thank you for additional information. I used the licensed version of Aspose.Words for testing.

Best regards,

then is pretty strange. Could this be cause of trial version of library?

Hi

Thank you for additional information. Aspose.Words evaluation version (without a license) has only two limitations: it limits the maximum number of paragraphs in the document and adds an evaluation watermark at the top of the document. But it’s exactly the same library.

Which version of Aspose.Words do you use? To check version of the library, right click on the dll, select Properties from the context menu, then select Version tab. You will see File version.

Best regards

well, how can we solve this problem?

The sales department is waiting for a green light from me, I cannot say that before this is fixed.

Ideas?

version image attached.

Hi

Thanks for your inquiry. I still cannot reproduce the problem on my side. Could you please create simple application, which will demonstrate the problem on my side? I will investigate the issue and provide you more information.

Also, have you tried using the same code on other machine, maybe something wrong with your machine?

Best regards,

Attached is the sample program and file I’m using.

Hi

Thank you for additional information. It seems that the issue occurs because you run your application in Visual Studio in debug. I am not sure why it is so slow in debug mode. If run the application without Visual Studio, i.e. run .exe file. It takes not more than 15 seconds to render your document.

Best regards,

Hi

yes, I can confirm that, if I run just exe I get such times

Loaded in: 0.7790446 sec
Rendered in: 10.9666272 sec
Saved to PDF in: 2.1371222 sec

Any idea if this will be fixed to run under Visual Studio as well?

Thx

Hi there,

Thanks for your inquiry.

I think this is an issue to do with Visual Studio attaching debug information to the running process which slows down rendering. I don’t think there is any fix needed. You can instead try running your process in Release mode in Visual Studio and see if that solves the problem.

Thanks,

Release mode does not help either.

Hi there,

Prehaps try using Process Monitor to see if Visual Studio is accessing any files during processing and hanging for a longer time than it should. You may also want to try deleting the project .suo file and see if that helps at all.

Thanks,