It is possible to repeat a header and footer for every page in a React PDF Generator.

1 Answer 1149 Views
PDF Processing
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Tejas asked on 22 Nov 2023, 07:45 AM
It is possible to repeat a header and footer for every page in a React PDF Generator.

1 Answer, 1 is accepted

Sort by
1
Accepted
Vessy
Telerik team
answered on 22 Nov 2023, 12:32 PM

Hi, Tejas,

You can add both a header and a footer to the exported pdf via PageTemplate, you will only need to position the passed elements differently.

For example, you can have a similar setup:

Regards,
Vessy
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Tejas
Top achievements
Rank 2
Iron
Iron
Iron
commented on 23 Nov 2023, 05:47 AM

Wow, it's great. is working perfectly. But I have one question on my mind. It is possible to click the button; it will generate a pdf and show the same browser.

Vessy
Telerik team
commented on 24 Nov 2023, 05:49 PM

Hi, Tejas,

Currently, this is blocked on the browser level, and we have no direct option to do it:

https://stackoverflow.com/questions/48420833/open-automatically-a-downloaded-file 

Tejas
Top achievements
Rank 2
Iron
Iron
Iron
commented on 27 Nov 2023, 11:05 AM | edited

Any solution based on this PDF can be sent as a backend and used in the API.

Tejas
Top achievements
Rank 2
Iron
Iron
Iron
commented on 28 Nov 2023, 06:41 AM

It is possible to direct print option this Pdf
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
commented on 28 Nov 2023, 07:49 AM

How to convet this Pdf as Base64 
Konstantin Dikov
Telerik team
commented on 28 Nov 2023, 09:52 PM

Hi Tejas,

You can take a look at the following example demonstrating how you can get the PDF as base64. The example also demonstrate how you can load it in a PDFViewer (where you can print it):

Hope this helps.

Tejas
Top achievements
Rank 2
Iron
Iron
Iron
commented on 29 Nov 2023, 05:44 AM

Thanks for this example. I am trying this logic in my code, but I am not able to convert it tobase64. Please suggest how I can modify the code I am providing. My link to that type I am implementing a code.

https://stackblitz.com/edit/react-kd4nyh-ceszzg?file=app%2Fmain.jsx

Konstantin Dikov
Telerik team
commented on 29 Nov 2023, 06:29 AM

Hi Tejas,

The "k-pdf-export" class will be added only during the export, so the element that you are trying to get reference to in the example does not exist at that point. You can add a class name or an id to the container which you want to export and use it instead:

Let me know if everything is working correctly on your side too.

Tejas
Top achievements
Rank 2
Iron
Iron
Iron
commented on 29 Nov 2023, 07:56 AM

Thank you. Is it working? But unfortunately, I have to render a header and footer on every page, but after this, I converted base64  and checked a pdf viewer, and my header and footer did not show. How can we fix this issue?

https://stackblitz.com/edit/react-kd4nyh-lmbrac?file=app%2Fmain.jsx

Konstantin Dikov
Telerik team
commented on 01 Dec 2023, 07:39 AM

Hi Tejas,

Since we are not using the PDFExport, but the "exportPDF" method from the package, you need to pass the page template within the drawDOM method in the object with the options:

More details can be found in the following help article:

Tags
PDF Processing
Asked by
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Vessy
Telerik team
Share this question
or