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

Free Support Forum - aspose.com

Add text with different size using Aspose.PDF for .NET - TextState of TextSegment in Heading is ignored

We want to add headings to pages and - if the topic doesn’t fit on one page - write a [continued] heading on the next page.

The [continued] addition should be written in a smaller font.

We tried several scenarios, but the font of the segment is always the same as the font of the heading itself.

Please take a look at the following simplified sample code:

    Aspose.Pdf.License license = new Aspose.Pdf.License();
    // Instantiate license file
    license.SetLicense("LGSolutions.Finance.Portal.Aspose.Pdf.lic");
    // Set the value to indicate that license will be embedded in the application
    license.Embedded = true;

    var pdf = new Aspose.Pdf.Document();

    Page page = pdf.Pages.Add();

    var heading = new Heading(1) { Text = "Header 1" };
    page.Paragraphs.Add(heading);

    heading.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Times New Roman");
    heading.TextState.FontSize = 20;

    Aspose.Pdf.Text.TextSegment segment2 = new Aspose.Pdf.Text.TextSegment("  [continued]");
    segment2.TextState.FontSize = 10;

    heading.Segments.Add(segment2);

    var memoryStream = new MemoryStream();
    pdf.Save(memoryStream);
    memoryStream.CopyTo(this.Response.OutputStream);

    Response.ContentType = "application/pdf";
    Response.AppendHeader("Content-Disposition", "inline; filename=Test");

    return new EmptyResult();

Thanks for your assistance!

@cool_aspose_4711

Thanks for contacting support.

We have managed to reproduce the issue in our environment after testing the scenario with your code snippet and logged an issue as PDFNET-43951 in our issue tracking system. We will further investigate the reasons behind this 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.

I noticed the same issue, guessing the issue is not solved yet ?

Thanks

@giedrius14

Regretfully, the ticket is not yet resolved as it has low priority and will be investigated/resolved on first come first serve basis. We will surely inform you as soon as we have certain updates regarding its rectification. Please spare us some time.

We are sorry for the inconvenience.