Instead of createHtmlOutputFromFile(filename) use createTemplateFromFile(filename)
The above because the first returns a HtmlOutput object which not allow to add properties while the second returns a HtmalTemplate which allows to add properties.
Reference