Embedded PDF: Page number?

Hello,

I would like to print the page number on a PDF I embed via the image function. This is what I have:

#set page(width: auto, height: auto, margin: 0pt)

#set figure(
supplement: none
)

#figure(image("test.pdf", page: 1), caption: [ #context { counter(page).display() } ] )
    

Is there a better way to do this? Especially, to make sure that the page number is at the same height as “regularly”.

Thanks!

Maybe an idea I just had myself would be to always define the footer in a certain way, so even when a PDF is embedded with a page setup with 0 margin the layout of the page numbering stays consistent:

#set page(
  paper: "a4",
  numbering: "1",
  margin: 2cm,
  footer: place(bottom + center, dy: -1cm, context { counter(page).display() })
,
)

#lorem(30)

#pagebreak()

#set page(
  paper: "a4",
  margin: 0cm,
)

#figure(
  image("test.pdf", page: 1, width: auto, height: auto)
)