Ported pagefromfile.py to core

Bug: 56897
Change-Id: Id238d86cd72851b027c9c0b5bd20fa0da41d5f13