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

Free Support Forum - aspose.com

How to Reset Page Number for each record in PDF document

Hi,

We are using Aspose.pdf generator to generate the PDF document. In the document we are creating two sections for each record combination. We have to create 2 different sections because Header and footer of both the sections are different.

In first section we show product and in next section we show sales.

For example we have 2 pages for Product "ABC" and 2 page for sales of this product in this case page no. should go 1 to 4.

For next product "XYZ" it should reset again to 1 and it should increase for each page.

Can you please let me know how to achieve this functionality.

It is urgent for my project to implement this asap hence request a swift reply.

Hi,

We are using Aspose.pdf generator to generate the PDF document. In the document we are creating two sections for each record combination. We have to create 2 different sections because Header and footer of both the sections are different.

In first section we show product and in next section we show sales.

For example we have 2 pages for Product "ABC" and 2 page for sales of this product in this case page no. should go 1 to 4.

For next product "XYZ" it should reset again to 1 and it should increase for each page.

Can you please let me know how to achieve this functionality.

Hi there,


Thanks for your inquiry. You can easily achieve your requirements by using ($Sp and $SP) replaceable symbols in your header/footer. Please check following documentation link for details.


Please feel free to contact us for any further assistance.

Best Regards,

Thanks for your reply.

The solution ($Sp and $SP) you provided will not work in my scenerio mentioned in my previous post as i am having 2 different sections. We have 2 sections related to one complete record. Session 1 & 2 will have different header and footer. for example for record 'A' , first section have 2 pages and second section is having 2 pages then page no should go from 1 to4 . For next record "B" it should again reset to 1.

Let me know if above mentioned requirement is not clear.

Looking for your response.

Hi there,


Thanks for your feedback. As you mentioned you are using different header footer for both sections. So you can use $Sp and $SP in your header/footer to reset page number for each section. Can you please share your sample code using for the purpose? So we look into it and guide you accordingly.

Best Regards,

HI,

As you suggested above to use $Sp and $SP in my header footer to reset page number for each section. But my requirement is differenent and not to reset page no for each section. I don't want my page number to get reset for section 2 , section 2 will increament the last page number from section 1.

Just to give more clear picture about the scenerio below is the example :

We are generting 2 reports - diagnosis and quality for each patient. Hence for each patient page number should reset to 1. Suppose for patient p1, 2 pages generated for Diagnosis hence page no. will go 1&2 in section1 and then for quality report for same patient p1, 3 pages generted in 2nd section2 then page no. on quality report should go from 3,4,5. Here report ended for patient 1.

For next patient p2 report generation started and then page no. should now reset to 1.

I hope above requirement is clear and will give you more clear idea about desired functionality.

I will share the code base if above reqirements are not cleared.

Thanks

Hi there,


Thanks for additional information and please accept my apologies for misunderstanding the requirements. For your requirement of resetting page numbering please use IsPageNumberRestarted property of section for the purpose. Hopefully it will fulfill your requirements. If issue persist then please share your sample code here. So we will test it and provide you more information accordingly.

Please feel free to contact us for any further assistance.

Best Regards,