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

Free Support Forum - aspose.com

How to speed up UpdatePageLayout method

Please let me know, what could be reason for very bad performance when first calling method Document.UpdatePageLayout on computers by my customer. For now I found out that this method is reason for bad performance when saving to pdf format. If I don’t call this method than Save(… , SaveFormat.Pdf) method is slow.

I made an example with the latest version of Aspose.Words using .NET 4.0:

using System;
using Aspose.Words;
using System.IO;
using System.Diagnostics;

namespace TestAsposeWords
class Program
static void Main(string[] args)
for (int i = 0; i < 3; i++)

static void TestAspose()
Stopwatch stopWatch = new Stopwatch();
var d = new Document();
TimeSpan ts = stopWatch.Elapsed;
Stream s = new MemoryStream();
stopWatch = new Stopwatch();
d.Save(s, SaveFormat.Pdf);
TimeSpan ts1 = stopWatch.Elapsed;

Console.WriteLine(“UpdatePageLayout: {0:00}:{1:00}.{2:000}, Save: {3:00}:{4:00}.{5:000}”, // , pdf: {6:00}:{7:00}.{8:000}",
ts.Minutes, ts.Seconds,
ts.Milliseconds / 100,
ts1.Minutes, ts1.Seconds,
ts1.Milliseconds / 100);
d = null;

This example takes more than 30 seconds for first time on Win 2007 Terminal Server (64 bit, 12 GB RAM, Intel Xeon CPU, L520, 2,27 GHz):
UpdatePageLayout: 00:36.007, Save: 00:00.001
UpdatePageLayout: 00:00.000, Save: 00:00.000
UpdatePageLayout: 00:00.000, Save: 00:00.000

In my environment I could’t reproduce such bad performances.

Is there anything what I can do? Is there something known at system level (maybe printers or somesthing like this)?

I think I solve the problem. There was two entries in registri under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts, where the font file name was on nonexisting server and file share.

Much better first time Save to PDF format in Aspose.Words version 15.x and 11.0.

Hi Stanko,

Thanks for your inquiry. Aspose.Words needs to precache fonts and other resources for rendering or updating page layout but this only happens for the first time when you convert to PDF or call this method. It is great you were able to solve this problem on your end. Please let us know any time you have any further queries.

Best regards,