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

Free Support Forum - aspose.com

Styling of header content lost after page break

Hi,

I add content to a page’s header with the following code:

                TextFragment tf = new TextFragment();
                TextSegment t = new TextSegment("This is my Content");
                t.TextState = pdfSettings.TextInfoHeadline;
                tf.Segments.Add(t);
                if (page != null)
                {
                    page.Header = new HeaderFooter();
                    page.Header.Margin = new MarginInfo();
                    page.Header.Margin.Top = PdfSettings.CalcFromMM(10);
                    page.Header.Margin.Left = PdfSettings.CalcFromMM(10);
                    page.Header.Paragraphs.Add(tf);                                        
                }                

page is of type Aspose.PDF.Page

The textstate is defined as followed:

public TextState TextInfoHeadline => new TextState
{
Font = defaultFontRegular,
ForegroundColor = Color.FromRgb(System.Drawing.Color.FromArgb(0, 73, 164)),
FontSize = 22
};

On the first Page the content in the header area is styled correct. If a second page is automatically added (automatic pagebreak) the header text ist shown in the correct place but the styling has gone - it looks like the Textstate is not copied to the page heades after the first page.

Any hints?

Best regards,

Andrei

@awestphal

Thanks for contacting support.

I have tested the scenario with latest version Aspose.Pdf for .NET 17.7 and observed that the formatting of header was lost after page break. Hence I have logged an issue as PDFNET-43058 in our issue tracking system. We will further look into the details of the issue and keep you updated with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali