page layout

Has anyone implement or could share tips on how one would proceed to display a document with a page layout.

I’m thinking of something similar to google docs that visually displays pages on screen with their margins and page numbers.

As an alternative, even without displaying pages, has anyone implemented a way to calculate and display page numbers that would correspond to the actual page numbers when printing a document?