One option is to draw a white rectangle over the existing page number text,
then add your own. Unless your requirements are very strict about font
selection, this is an easy approach.

K

On Wed, Dec 25, 2024, 5:50 AM Tilman Hausherr <thaush...@t-online.de> wrote:

> Hi,
>
> There is no concept of a "page number" in PDF (except for what I
> mentioned in my previous answer, which apparently isn't what you're
> searching for). Your page number can be at any place, in any font, or
> not be there at all.
>
> To get some understanding, open your file with PDFDebugger and look at
> the content stream. In your file it is here:
>
> 1 0 0 -1 0 841.9 cm
> /Artifact << /Attached [ /Bottom ] /BBox [ 90 49.600044 505.3 73.98004 ]
> /Type /Pagination >> BDC
>    q
>      1 0 0 1 90 767.92 cm
>      -90 0 m
>      505.3 0 l
>      505.3 24.38 l
>      -90 24.38 l
>      h
>      W
>      n
>      BT
>        /FAAAAH 9 Tf
>        1 0 0 -1 205.279 7.637 Tm
>        0 g
>        [ (1) ] TJ
>        /GS1 gs
>        0 g
>        [ ( ) ] TJ
>      ET
>      q
>        1 0 0 1 0 12.19 cm
>      Q
>    Q
> EMC
>
> The font is a font subset that has only the "1" but not 2 so you can't
> reuse it.
>
> And then there's the problem with signed PDFs whose signature will be
> invalid.
>
> Tilman
>
>
>
> On 25.12.2024 13:29, 遇夜 wrote:
> > How to add or modify the page number of the last page of a PDF so that
> > it is continuous with the page number of the previous page and
> > maintains the same page number format as the previous page
> >
> > We always add an attachment PDF with only one page to the end of a
> > main text PDF to obtain the merged file above. However, we need to
> > ensure that the page numbers of the last attachment page are
> > continuous with the main text page numbers, and that the font and
> > formatting are consistent. It may be in "1" or "1/2" format. The
> > attachment page may not originally have page numbers, so it is
> > necessary to add page numbers; It is also possible that page numbers
> > already exist, in which case page numbers need to be modified.
> >
> > How can I do it? I hope to get the complete code. Thank you for your
> > support
> > ------------------------------------------------------------------------
> >
> > 遇夜
> > 1239281...@qq.com
> >
> > <
> https://wx.mail.qq.com/home/index?t=readmail_businesscard_midpage&nocheck=true&name=%E9%81%87%E5%A4%9C&icon=http%3A%2F%2Fthirdqq.qlogo.cn%2Fek_qqapp%2FAQDiaHZC0YVjDPI7OXkoRZT1F7VUOdkba2ywpScq4mybTOxdydg6n0KPWX0iaqv53umcbqXB43%2F0&mail=1239281248%40qq.com&code=h3rw-GxjgiSMnaQsJoVtjAa7Hj1NqgnSpekJvfuW321hMCaYZU88FTlt1PlA5w0_A8raZavXyxM575LEh9-iOA
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
> > For additional commands, e-mail:users-h...@pdfbox.apache.org
>
>

Reply via email to