This is a migrated thread and some comments may be shown as answers.

How to add page numbers to a merged PDF file

1 Answer 504 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 13 Mar 2020, 10:31 PM

I'm having trouble finding documentation/example code for adding page numbers to merged PDF file.  Merging of PDF files/pages I can do, adding page numbers to this new document, I cannot do.  Can anyone point me in the right direction?

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 17 Mar 2020, 11:21 AM

Hello Barry,

We have a good SDK example in our GitHub repository: DrawHeaderFooter. The example demonstrates how to draw headers and footers to an existing document using PdfProcessing`s FixedContentEditor class. In the DrawHeaderAndFooterToPage() method you can see how the page numbering is implemented in the footer.

I hope you find this information helpful.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
T
Top achievements
Rank 1
commented on 16 Dec 2024, 12:50 PM

Hi Martin,

unfortunately, the proposed solution to Barry's request is NOT working anymore, at least since 2024.4.1111 (i.e. 2024 Q4) of UI for WPF, as the editing (or inserting) any text destroys (smoetimes) the content of existing pdf pages instead of simply adding and/or overlaying the edits.

Any idea how to remedy this unacceptable effect?

Thank you!

Yoan
Telerik team
commented on 16 Dec 2024, 04:26 PM

Hello,

It is possible that you are encountering an issue on our part which we are already aware of, that was introduced with the Q4 2024 release - PdfProcessing: Missing Text with specific cultures (e.g. German).

That said, I am unable to confirm this without having any resources at my disposal which I can examine first. One thing I can suggest you try is the workaround in the above-linked task. Because the issue is influenced by the currently set culture, changing the culture explicitly to "English (en-US)" should resolve the fix you are experiencing:

Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

If that does not resolve the issue, then you are most likely facing something else and I would require some additional resources in order to achieve the same results on my end, examine them, and try to identify the cause. It would be much appreciated if you could share with us the document used on your end and the code/project that reproduces the unexpected results.

If it comes to sharing resources, please keep in mind that this is a Q&A Forum thread and anything shared here will be publicly accessible.

I hope this helps. Let me know how it goes.

Regards,

Yoan 

T
Top achievements
Rank 1
commented on 17 Dec 2024, 10:03 AM

Hi Yoan,

indeed, the change of the current culture info in the thread calling all the Telerik-related stuff was the solution to my problem. Now, all pdf pages in the final document are correctly numbered while its content is exactly as the original document (that with no page numbers).

Great advice, thanks!!

 

Final remark: For introducing a bug into the update of the Telerik package, that's a really nasty one. Congratulation to anyone who ever has caused it. Without this astonishing hint I would have searched for a solution forever (and probably not only me...)

Yoan
Telerik team
commented on 17 Dec 2024, 01:32 PM

Hello,

Thank you for the positive feedback. I am glad to hear the suggested workaround has been sufficient in resolving the issue you are experiencing. I would also like to mention that the PdfProcessing: Missing Text with specific cultures (e.g. German) task is currently under development and if everything goes as planned we intend to introduce the fix in our upcoming Q1 2025 official release scheduled for mid-February.

Thank you for your patience and understanding,

Yoan

Tags
General Discussions
Asked by
Barry
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or