I used NextJS Markdown to create page and then print it via browser.
There I can render React component as well. So wrote the below React component.
export default function PageBreak() {
return <div className="break-after-page" />
}
Then, when I want to add page break I just added <PageBreak />
More info here - https://nextjs.org/docs/app/guides/mdx
PS: Project also had tailwindcss.