Free Support Forum - aspose.com

Page.Number returning an incorrect number in OnBeforePageGenerate Event Callback

We are using Aspose PDF for .NET library v 19.11 in our project for creating pdf documents from HTML markup.

Page’s OnBeforePageGenerate event is being used to generate header for each page, below is a snippet of code demonstrating that

page.OnBeforePageGenerate += (sender) => OnPageGenerate(sender, metaInfo, section.Id, true, dtHeaders[section.Id][0].FormattedText, section.DisplayPageNumbers, lstElementEntity, lstElementPropertyEntity, lstStepEntity, generatedFiles, headerChangeLog, isChangeLog);

Now when page.Number is being accessed inside the callback it is returning an incorrect page number. Can you please investigate it.

Thanks
10pearls

@10pearls,

Thanks for contacting support.

Can you please share complete working sample code along with source file so that we may further investigate to help you out. Also please try to use Aspose.PDF latest version 20.1 on your end before sharing requested information.