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

Free Support Forum - aspose.com

DigitalSignatureUtil.Sign number of pages in word incorrect

We create a word document with c#/openxml. The document has 8 pages.
If we insert a certificate “DigitalSignatureUtil.Sign …” with Version 17.8 the document shows 13 as total page number.
But there are only 8 pages.
Any idea how to correct the total page number?


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

thank you for your answer.
I want to upload but where is the button to attach files?

I have found the upload feature.
The following message appears:
Sorry, that file is too big (maximum size is 3072kb). Why not upload your large file to a cloud sharing service, then share the link?

Where can I upload the zip-file?

AsposeDigitalSignatureUtilTest.zip (469.0 KB)

to run the Visual Studio 10 - solution
please insert “Aspose.Words.dll” (Version 17.8) in directory
I did not include the file, because the zip-file would have become to large.

input word document, see zipfile, InvoiceTest-20170816.docx
output word document, see zipfile, InvoiceTest-20170816Signed.docx

sorry, it is a solution in Visual Studio 2015.

Another hint:
in another word document there is shown “49 of 13 pages” after input of the certificate.
13 seems to be constant …

Best regards
Mike Semmler


Thanks for sharing the detail. Please note that DigitalSignatureUtil.Sign does not update the fields. If you want to get the updated value of NUMPAGES field, please use the following code example. Hope this helps you.

Document doc = new Document(MyDir + "InvoiceTest-20170816.docx");
doc.Save(MyDir + "UpdateFields InvoiceTest-20170816.docx");

CertificateHolder certHolder = CertificateHolder.Create(MyDir + "CertKanlogTestEAS.pfx", "password");
DigitalSignatureUtil.Sign(MyDir + "UpdateFields InvoiceTest-20170816.docx", MyDir + "Signed.docx", certHolder);