WordDoc fit to single page

I already tried the example given in forums
Aspose.Words - shrink to fit one page
in this it changes the complete document to one font style. but in my document having 4 fonts.
my requirement is to change the fonts accordingly for example:
let assume that my document having title; subtitle and the paragraph.
title is in 24 font ; subtitle is in 20 font and the paragraph is in 16 font. if the data exceed the one page i want to change the tile to 22; subtitle to 18 and paragraph to 14. I need a solution to reduce the font in percentile manner or give me the lines of code to solve this problem.
Here I attached the document on which I worked.

Hi there,


Thanks for your inquiry. Please use Document.PageCount property to get the number of pages in the document as calculated by the most recent page layout operation.

In your case, we suggest you please iterate through all paragraphs of document and get the style name of a paragraph using ParagraphFormat.StyleName property. Please use Style.Font.Size property to change the font size of style. Hope this helps you. Please let us know if you have any more queries.