Free Support Forum -

PageNumberStamp is not working

Hi, I am adding PageNumberStamp object to each page when there is an HtmlFragment after a TextFragment, the PageNumberStamp will disappear in the PDF.

This only happens when the PageNumberStamp and TextFragment are using different font styles.

Aspose.Pdf .net 10.7.0

var doc = new Document();
var page = doc.Pages.Add();
var text = new TextFragment(“textfragment”);
text.TextState.Font = FontRepository.FindFont(“Proxima Nova Bold”);

var html = “

Html text

var htmlFrag = new HtmlFragment(html);

var outFile = @“C:\temp\Muli-Column.pdf”;
//create page number stamp
var pageNumberStamp = new PageNumberStamp
Background = false,
Format = "Page # of " + doc.Pages.Count,
BottomMargin = 10,
HorizontalAlignment = HorizontalAlignment.Center,
StartingNumber = 1
pageNumberStamp.TextState.Font = FontRepository.FindFont(“Arial”);
pageNumberStamp.TextState.FontSize = 14.0F;
pageNumberStamp.TextState.FontStyle = FontStyles.Bold;
pageNumberStamp.TextState.FontStyle = FontStyles.Italic;
foreach (Page page1 in doc.Pages)

By the way, my purpose is to add Page Number to each page when I am generating a new PDF(not existing), so I cannot get the exact page count if I don’t call method :page.ProcessParagrahs(),

If there is a better way to approach this, please tell me, thanks.

Hi Patrick,

Thanks for using our API’s.

have tested the scenario and I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-39320 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.<o:p></o:p>