NewPage Generation Event

Posted by: aruiz on 18 January 2019, 1:27 am EST

    • Post Options:
    • Link

    Posted 18 January 2019, 1:27 am EST

    Hi!

    Currently I’m making a PDF where I want to render a RenderObject to the document in the moment that the new page is created, using the startDoc() and endDoc(), so I can construct the PDF on the way. I found out that there’s an event called OnPageAdded(), but it seems if I Render an object and that moment the Event is triggered since is going to write the Object in the next page, if I try on the event to Render an other object, it seems that the page context is in the last page and not on the new one. So if I try to render an object on the event, it will trigger the event again because of the Object doesn’t fit in the page, and so on until an Error throw since it will trigger the event every single time until the error is throw.

    So, is there other event when the new page is generated so it can be writed before the actual Object is about to be render, to render something at that moment.

    An other solution planned is to use a flag to know when the OnPageAdded() event has been triggered and delete the last rendered Object from the new page created, Render the object I need to be rendered at the beginning of the page and then re render the deleted object. But it seems that there is not a function like UnRenderObject() so I can’t delete it. Also I so the visibility property of the RenderObject() but it seems that if I set it to collapse or hidden, it will not show the object but a blank space will be in it’s place…

    Any solution to render an object just after a new page is created and before the ongoing rendering of an RenderObject is going to be write on the document on the execution of RenderObject()

    Or a way to Delete a rendered object?

    Or if grapeCity is looking at this post, is possible to add, NewPageGenerated() event were I can do what I said on the top?

    PS: This is mostly used when I render a huge table and I want to include a little header on each page.

  • Posted 21 January 2019, 4:42 pm EST

    Hello,

    Thanks for the description.

    Please refer the attached sample wherein headers are rendered on every page containing the table, such that the table also splits fine.

    Further, a pdf can be generated from the document by exporting it to pdf.

    Please note that adding a new event to the control will not be possible: https://www.grapecity.com/en/forums/winforms-edition/c1report-is-now-obsolete-t

    Regards,

    EshaC1PrintDocument_NewPage.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels