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

Free Support Forum - aspose.com

Nested Paging/ Section wise Paging / Sub Pager

Requirement:
To have a overall paging on the document i.e. Page 1 of 20
To have section wise paging as well i.e. Page 1 of 5.

Problem:
We are unable to display section wise page.

Approach:

Overall paging
For overall paging, we have used

TextFragment hfHeaderTxt2 = new TextFragment(“Page $p of $P”);

The above code is being called in “page.OnBeforePageGenerate” event. (see line#258 in pdfHelper.cs)

Section wise Paging
Our document contains multiple section. Each section may render on multiple pages. For example: we have 2 sections i.e. “section ABC” and “section XYZ”.
Content of “section ABC” renders in 3 pages. so each page header should show
“Page 1 of 3”, “Page 2 of 3” and so on.
Paging should be reset when a new section starts.

We are managed to print the page number and able to reset when new section starts (see implementation in AddHeader method at line#229). We are unable to get the total count of pages a section will take, hence not able to show total count of page.

Please see the attached [PdfGenerationApplication.zip]
Addmethod at line#158 is the method responsible for creating pdf docuement. This method calls OnPageGenerate event responsible for displaying header and paging.

@sanobar_nishat

We are checking this and will get back to you shortly.

Any update on the section paging issue

@sanobar_nishat

Please always share SSCCE code and never include license in attachments. You can also delete the files in packages folder which can later be restored from NuGet at our end.

Moreover, how do you distinguish between different sections because total number of pages per section would need to set accordingly. Would you please simplify your use case as per SSCCE because it includes a lot of information that can probably be minimized further in a separate solution or code snippet.

Thanks for your reply. Please use this link to download updated sample project

I have made changes you mentioned. Please only look for

AddHeader(page, sectionId);
in pdfHelper.cs > GeneratePdf() > OnPageGenerate() > AddHeader()

We identify each section by its id.
In GeneratePdf method , we loop through each section (line#169) and add “AddHeader” method on “OnBeforePageGenerate” event (line#176). AddHeader method is responsible to populate the header details on addition of a new page of a section.

AddSectionContent(page, procedureEntity, section.Id, generatedFiles);
(line#178) is responsible to populate the content of a section.

I need help in AddHeader method to know how to find total page a section will take while rendering, so that i can display it on a page header i.e. Section Page 1of 5.

Hope the requirement is clear now.

@sanobar_nishat

Thank you for elaborating further.

We are afraid number of pages may not be counted while adding the content so we have logged a ticket with ID PDFNET-47098 for further investigations. We will let you know as soon as any update will be available in this regard.

Thanks for the reply.

Is there any possibility, that after rendering the content and creating all the pages. We access each page again and update total page count in each page, as now we have idea of total pages generated

@sanobar_nishat

After generation of PDF, distinguishing between different sections can be tricky. We will be able to share some work around if possible, once the ticket will be investigated.

Any update on the section paging issue?

@sanobar_nishat

Thank you for getting back to us.

Please note that the issue has been logged under free support model and will be investigated on first come first serve basis. Therefore, it may take some months to resolve. As soon as we have some definite updates regarding ticket resolution, we will let you know.

Furthermore, we also offer paid support model where issues are resolved on urgent basis and have priority over the issues logged under free support model. You may check our Paid Support options for your reference.

@Farhan.Raza, do we have any update on this? Thanks.

@10pearls

We are afraid any update is not available yet. We will let you know once some information will be available.

@Farhan.Raza, do we have any update on this? can we be expecting a resolution or workaround anytime soon?

@10pearls

We are afraid it may take a few months because of other critical and priority tickets in the queue. We will be able to share a workaround once it is investigated. We appreciate your patience and cooperation.

Can you please confirm if is it available now? Or can you please confirm the roadmap for this to include in coming release?

@10pearls

Regretfully the ticket is not yet resolved. However, we will surely resolve it as per the schedule and let you know as soon as we have some certain updates in this regard. We are afraid that we cannot share any reliable ETA at the moment because there are other high priority issues which are pending. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali @Farhan.Raza We’d like this to be escalated to business support ASAP. Please advise if you need any info and what the ETA for resolution of this issue will be. We had a pretty bad experience with the last 3-4 business support cases so are hoping this one will be expedited quickly. Thanks.

We just opened a ticket here https://helpdesk.aspose.com/tickets.php?id=6728. Please advise if you need any other info

@10pearls

Your issue has already been escalated to priority support and you will surely be receiving our feedback in newly generated ticket over helpdesk.