Programmatically sending images (not thumb) to the media folder

I’m building a page to PDF generation sort of plugin but I’m struggling with the media folder.
I created a dedicated route so that visiting something like ?pdf=true displays this page as a pdf.
The thing is that medias are not in the media folder yet, only thumbs generated, I suppose, for the panel, are.
I’ve read that calling ->url() is sufficient to send the media file image into the media folder of the page… but it’s not working. I don’t understand. I have to visit the normal frontend for it to trigger the actions of generating the /media versions of the images.

Is it normal? Is there something I’m missing?

What would be the best way of generating all the medias for this collection of posts?

$file->publish() creates a copy of a file in the media folder: $file->publish() | Kirby CMS

:glowing_star: perfect. I simply miss-read the flippin manual. Thank you very much.
Calling the ->publish() on the specific images I need inside the pdf fixed the issue.